I am trying to write a facebook application using app-engine-patch and pyFacebook. I use only the examples provided with each tool, and for some reason it will not work.
I combined the two, as described in the accepted ansvet here: Facebook, Django and Google App Engine
app-engine-patch works fine, but when I try to use @ facebook.require_login (), I get this from GAE 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 happens no matter what kind I decorate with @ facebook.require_login ()
I am using the latest of both projects and I have no idea why this is not working.
Thanks so much for your time.
UPDATE: I made quickfix for pyFacebook, but I just forgot to return it to the stream.
Now also the 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'])
For this:
if params.get('expires'): if params['expires'] == 'None': params['expires'] = 0 self.session_key_expires = int(params['expires'])
It will work, but it will hack, and perhaps it can be done more elegantly, but it works. Should point pyFacebook developers to this topic, maybe they will have a better solution.