AttributeError: 'Facebook' object has no attribute 'graph' #113

Open
nicksergeant opened this Issue Sep 28, 2011 · 9 comments

Projects

None yet

4 participants

@nicksergeant

I switched to the facebook-sdk lib as per #111. After successfully connecting to FB using the FB button, the response results in:

Traceback (most recent call last):
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/wsgi.py", line 272, in __call__
    response = self.get_response(request)
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/base.py", line 169, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/base.py", line 203, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/Users/Nick/.virtualenvs/liveplay/src/django-socialregistration/socialregistration/views.py", line 171, in facebook_connect
    _connect(request.user, profile, request.facebook)
  File "/Users/Nick/.virtualenvs/liveplay/src/django-socialregistration/socialregistration/views.py", line 62, in _connect
    client = client)
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/Nick/.virtualenvs/liveplay/src/django-socialregistration/socialregistration/models.py", line 121, in save_facebook_token
    access_token = client.graph.access_token)
AttributeError: 'Facebook' object has no attribute 'graph'
@flashingpumpkin
Owner

Please try again with the newest HEAD, that's fixing some issues I've had with the new implementation too.

@nicksergeant

Seems to be working OK, now.

@nicksergeant

Actually, logging out of Facebook, then attempting to log in to the app with a new Facebook user results in the same error:

Traceback (most recent call last):
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/wsgi.py", line 272, in __call__
    response = self.get_response(request)
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/base.py", line 169, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/base.py", line 203, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/Users/Nick/.virtualenvs/liveplay/src/django-socialregistration/socialregistration/views.py", line 172, in facebook_connect
    _connect(request.user, profile, request.facebook)
  File "/Users/Nick/.virtualenvs/liveplay/src/django-socialregistration/socialregistration/views.py", line 62, in _connect
    client = client)
  File "/Users/Nick/.virtualenvs/liveplay/src/django/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/Nick/.virtualenvs/liveplay/src/django-socialregistration/socialregistration/models.py", line 121, in save_facebook_token
    access_token = client.graph.access_token)
AttributeError: 'Facebook' object has no attribute 'graph'
@jorilallo

Initial registration doesn't seem to work for me either (not finding graph).

@flashingpumpkin
Owner

@jorde

I advise using the 0.5 branch for new installations. It's tested and got rid of the nasty javascript parts that were involved in the registration process in favour of the server side flow. It's not on pypi yet because I broke a lot from 0.4 in favour of adding the testing and breaking it up into multiple modules

@jorilallo

Thanks. Tried the branch but can't get it working with Facebook as it doesn't seem to like my redirect url (localhost:8080). Not sure how to set it up in Fb's app settings but this isn't really related to the app.

Not sure if this is an existing bug but Twitter login won't work because of the following error:

Traceback:
File "/Users/jorilallo/.virtualenvs/project/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/Users/jorilallo/.virtualenvs/project/lib/python2.7/site-packages/django/views/generic/base.py" in view
  2.         return self.dispatch(request, _args, *_kwargs)
    
    File "/Users/jorilallo/.virtualenvs/project/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  3.     return handler(request, _args, *_kwargs)
    
    File "/Users/jorilallo/.virtualenvs/project/src/django-socialregistration/socialregistration/views.py" in get
  4.     client = request.session[self.get_client().get_session_key()]
    
    File "/Users/jorilallo/.virtualenvs/project/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py" in getitem
  5.     return self._session[key]
    

Exception Type: KeyError at /social/twitter/callback/
Exception Value: 'socialreg:twitter'

@jorilallo

The former worked after settings:

SOCIALREGISTRATION_SESSION_KEY = 'socialreg:'

@wesc
wesc commented Nov 14, 2011

I'm seeing the same missing graph issue, though my tracebook looks different. I'm using the most up to date socialregistration (as of this morning), and facebook-sdk. Is there any particular info I can get you that would be useful in debugging this?

Environment:

Request Method: GET
Request URL: http://localhost:7626/accounts/profile/

Django Version: 1.3.1
Python Version: 2.6.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.humanize',
'socialregistration',
'socialregistration.contrib.facebook',
'collage',
'api',
'search',
'gravatar',
'webutils',
'south']
Installed Middleware:
('collage.middleware.PatchResponseHeadersMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'socialregistration.contrib.facebook.middleware.FacebookMiddleware')

Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/home/wesc/src/soco/web/collage/views.py" in profile
  2.     graph = request.facebook.graph
    
    File "/usr/lib/pymodules/python2.6/django/utils/functional.py" in getattr
  3.     return getattr(self._wrapped, name)
    

Exception Type: AttributeError at /accounts/profile/
Exception Value: 'Facebook' object has no attribute 'graph'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment