dhellmann/rst2blogger — Issue #3: AttributeError from target_blog.get_blog_id()
Author: g2boojum
Created: 2012-02-13 20:24:46+00:00
State: open

'''server blogger > rst2blogger --blog="Grant Goodyear's web log" rst2blogger.rst

Title: 'Testing rst2blogger'

Please choose the authorization mechanism you want to use.
1. to use your email address and password (ClientLogin)
2. to use a web browser to visit an auth web page (AuthSub)
3. if you have registed to use OAuth
: 1
Please enter your username: g2boojum@gmail.com
Password:
Retreiving blog list
Traceback (most recent call last):
File "/home/grant/.local/bin/rst2blogger", line 9, in
load_entry_point('rst2blogger==1.0.1', 'console_scripts', 'rst2blogger')()
File "/home/grant/.local/lib/python2.7/site-packages/rst2blogger/cli.py", line 81, in main
target_blog_id = target_blog.get_blog_id()
File "/home/grant/.local/lib/python2.7/site-packages/gdata/blogger/data.py", line 62, in get_blog_id
return BLOG_ID2_PATTERN.match(self.id.text).group(2)
AttributeError: 'NoneType' object has no attribute 'group'
'''

I ran rst2blogger w/ pdb running so that I could confirm that target_blog does attach to a gdata.blogger.data.Blog object which seems to have the correct title, author, etcetera. However target_blog.get_blog_id() fails.

I think this is another upstream problem.

'''
feynman blogger > rst2blogger --blog="Grant Goodyear's web log" rst2blogger.rst

Title: 'Testing rst2blogger'

Please choose the authorization mechanism you want to use.
1. to use your email address and password (ClientLogin)
2. to use a web browser to visit an auth web page (AuthSub)
3. if you have registed to use OAuth
: 1
Please enter your username: g2boojum@gmail.com
Password:
Retreiving blog list
> /home/grant/.local/lib/python2.7/site-packages/gdata/blogger/data.py(58)get_blog_id()
-> if self.id.text:
(Pdb) self

(Pdb) self.id.text
'tag:blogger.com,1999:user-g109916458529540333792.blog-30662840'
(Pdb) BLOG_ID2_PATTERN.match(self.id.text)
(Pdb)
'''

Given that BLOG_ID2_PATTERN = re.compile('tag:blogger.com,1999:user-(\d+)\.blog-(\d+)')
expects "user-\d+" in the tag instead of user-g\d+", it's not surprising that it fails.