Hi, I am trying to write a facebook app using app-engine-patch and pyFacebook. I am using nothing but the examples provided with each tool and for some reason it will not work.
I have combined the two just as described in the accepted answet here: http://stackoverflow.com/questions/984071/facebook-django-and-google-app-engine
app-engine-patch seems to work just fine but when I try to use @facebook.require_login() I get this from GAE's logs:
Exception in request:
Traceback (most recent call last):
File "/base/data/home/apps/app-name/1.339079629847560090/common/zip-packages/django-1.1.zip/django/core/handlers/base.py", line 92, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/base/data/home/apps/app-name/1.339079629847560090/facebook/djangofb/__init__.py", line 87, in newview
if not fb.check_session(request):
File "/base/data/home/apps/app-name/1.339079629847560090/facebook/__init__.py", line 1293, in check_session
self.session_key_expires = int(params['expires'])
ValueError: invalid literal for int() with base 10: 'None'
This happends no matter which view I decorate with @facebook.require_login()
I am using the latest from both projects and I have no idea why it wont work.
Many thanks for your time.
UPDATE: I made a quickfix for pyFacebook, but I just forgot to put it back in the thread.
Now also as an answer, since it seems to be the only way.
If you change facebook/__init__.py line 1292+ from this:
if params.get('expires'):
self.session_key_expires = int(params['expires'])
To this:
if params.get('expires'):
if params['expires'] == 'None':
params['expires'] = 0
self.session_key_expires = int(params['expires'])
It will work, but it is a hack and maybe it could be done more elegantly, but it works. Gotta point the pyFacebook devs to this thread, maybe they will have a better solution.