应用程序引擎补丁和pyFacebook无法正常工作 [英] app-engine-patch and pyFacebook not working
问题描述
我正在尝试使用app-engine-patch和pyFacebook编写一个facebook应用程序。
我只是使用每个工具提供的示例,并且出于某种原因它不起作用。
我已经按照接受回答此处:
Facebook,Django和Google App Engine
app-engine-patch似乎工作得很好,但是当我尝试使用@ facebook.require_login()时,我从GAE的日志中得到了这个:
请求中的异常:
Traceback(最近一次调用最后一次):
文件/ base / data / home / apps /名称/ 1.339079629847560090 / common / zip-packages / django-1.1.zip / django / core / handlers / base.py,第92行,在get_response
response = callback(request,* callback_args,** callback_kwargs)
文件/base/data/home/apps/app-name/1.339079629847560090/facebook/djangofb/__init__.py,第87行,在newview
中,如果不是fb.check_session(request):
文件/base/data/home/apps/app-name/1.3390796298 (无)'47560090 / facebook / __ init__.py,行1293,in check_session
self.session_key_expires = int(params ['expires'])
ValueError:
无论我用@ facebook.require_login()装饰哪个视图,都会发生
我正在使用这两个项目中的最新版本,我不知道为什么它不起作用。
非常感谢您的时间。 p>
更新:我为pyFacebook做了一个quickfix,但我忘了把它放回到线程中。
现在也作为答案,因为它似乎是唯一的方法。
如果您将facebook / __ init__.py行1292+更改为:
if params.get('expires'):
self.session_key_expires = int(params ['expires']] )
至此:
if params.get('expires'):
if params ['expires'] =='None :
params ['expires'] = 0
self.session_key_expires = int(params ['expires'])
它可以工作,但这是一种破解,也许它可以做得更优雅,但它的工作原理。
必须将pyFacebook开发者指向这个线程,也许他们会有更好的解决方案。 解决方案
/__init__.py line 1292+ from this:
if params.get('expires'):
self。 session_key_expires = int(params ['expires'])
至此:
if params.get('expires'):
if params ['expires'] =='None':
params [ 'expires'] = 0
self.session_key_expires = int(params ['expires'])
<它可以工作,但它是一种破解,也许它可以做得更优雅,但它的工作。
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: 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.
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.
这篇关于应用程序引擎补丁和pyFacebook无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!