Comment 36 for bug 569543

Revision history for this message
Niko Ehrenfeuchter (he1ix) wrote :

Well, so I had to learn how to debug python myself... If you're not interested in details, jump straight to the bottom of this message.

To see what's going on, I added the python-debugger to /usr/share/pyshared/gwibber/lib/gtk/facebook.py by adding "import pdb" at the end of the other import statements at the top of the file. After fiddling around a bit, I discovered the crucial point in "on_facebook_auth_title_change()", so I added a "pdb.set_trace()" right after the first "try:" statement in that function (see the attached diff if unclear). This makes python stop just after the facebook-connect has returned "Success" (which causes the "facebook authorized" state described in earlier posts). Here's the debugger's trace from that very position:

> /usr/lib/python2.6/dist-packages/gwibber/lib/gtk/facebook.py(115)on_facebook_auth_title_change()
-> url = web.get_main_frame().get_uri()
(Pdb)
(Pdb) n
> /usr/lib/python2.6/dist-packages/gwibber/lib/gtk/facebook.py(116)on_facebook_auth_title_change()
-> data = json.loads(urlparse.parse_qs(url.split("?", 1)[1])["session"][0])
(Pdb) n
IndexError: 'list index out of range'
> /usr/lib/python2.6/dist-packages/gwibber/lib/gtk/facebook.py(116)on_facebook_auth_title_change()
-> data = json.loads(urlparse.parse_qs(url.split("?", 1)[1])["session"][0])
(Pdb) n
> /usr/lib/python2.6/dist-packages/gwibber/lib/gtk/facebook.py(151)on_facebook_auth_title_change()
-> except:
(Pdb) p url
'http://www.facebook.com/connect/login_success.html'
(Pdb) p data
'Success'

This explains why the "Add" button does not show up, the split-statement fails since the "url" variable does not contain any of the expected information. So the try-except block stops right after the "data=..." line which clearly explains why the "Add" button still is missing. So the reason is that facebook returns an URI in a format quite different from what expected from gwibber.

First idea (already mentioned in an earlier post): language-related. Turns out to be the wrong direction, switching facebook to english doesn't make a difference.

But: clicking through my fb-settings, I discovered that Gwitter is already registered as an application having access to the fb-profile, even though the registration process never completed successfully in my gwibber client. Must be due to an earlier registration attempt failing (in gwibber, but not in facebook!) due to the keyring-bug (LP: #571224).

So the SOLUTION was to me: remove "Gwibber" from the list of applications (in your facebook-profile), then start all over with gwibber-client. Now the URI returned after completing the login contains all the information expected by gwibber and registration works!

Wohoo. Enjoy.