I've installed djangosocialregistration and it seemed like it was working fine for a while, but now I'm getting an error and I can't figure out where it's coming from. Inside my view I'm doing this to start looking at the API...
me = request.facebook.graph.get_object("me")
and I'm getting this...
'Facebook' object has no attribute 'graph'
After it quit working I rolled back a couple small changes I'd made, reset everything, deleted cookies and it's s开发者_JAVA技巧till not working. I'm running django 1.1.1 and it's slightly difficult for me to upgrade, not impossible though. I've been reloading a bunch trying to get it working, is there any possibility facebook throttles login connections on their end?
The Facebook class in the middleware of socialregistration looks like this:
class Facebook(object):
def __init__(self, user=None):
if user is None:
self.uid = None
else:
self.uid = user['uid']
self.user = user
self.graph = facebook.GraphAPI(user['access_token'])
If no user is set on __inii__
it will simply not set graph
. In the Middleware this should be set via:
fb_user = facebook.get_user_from_cookie(request.COOKIES, getattr(settings, 'FACEBOOK_APP_ID', settings.FACEBOOK_API_KEY), settings.FACEBOOK_SECRET_KEY)
request.facebook = Facebook(fb_user)
So my guess that the cookie from Facebook is not set for your site. Maybe you add some debug logging to determine if there is a cookie from facebook or not.
Another guess would be that request.facebook
is overwritten somewhere. Maybe you check this as well.
精彩评论