prayagverma / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

BLOG_ID2_PATTERN does not support g<numeric> user ids #578

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Request a list of blogs that contain ids that have gXXXX as part of the user id 
and you'll hit a harderror on the regexp group call.

This happens in 2.0.15 (the latest on PyPi)

An example ID which causes this error:

<id>tag:blogger.com,1999:user-g116027551916517628589.blog-3221819058568684886</i
d>

Traceback (most recent call last):

  File "...", line 255, in import_blogger
    context['blog_choices'] = [{'title': b.title.text.strip(), 'id': b.get_blog_id()} for b in blogs.entry]

  File ".../gdata/blogger/data.py", line 59, in get_blog_id
    return BLOG_ID2_PATTERN.match(self.id.text).group(2)

AttributeError: 'NoneType' object has no attribute 'group'

Original issue reported on code.google.com by dcra...@gmail.com on 2 Jan 2012 at 11:02

GoogleCodeExporter commented 9 years ago

Original comment by afs...@google.com on 2 Jan 2012 at 11:26

GoogleCodeExporter commented 9 years ago
Finally I reproduced the same problem on my local with the dev server. As 
mentioned in the original bug report the problem only occurs for users who have 
merged their Google+ and Blogger profiles. There is a recent blog post about it 
on code.blogger.com, 
http://code.blogger.com/2011/12/changes-to-profileid-for-google-profile.html

The solution is to change the regex named BLOG_ID2_PATTERN from 
'tag:blogger.com,1999:user-(\d+)\.blog-(\d+)' to 
'tag:blogger.com,1999:user-(g?\d+)\.blog-(\d+)' in order to include 'g' to the 
beginning of the profile id.

Original comment by umut.ut...@gmail.com on 4 Jan 2012 at 6:19