Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError at /user/login/yahoo/ 'Association' object has no attribute 'id' #78

Closed
kbussell opened this issue Nov 8, 2013 · 1 comment

Comments

@kbussell
Copy link

kbussell commented Nov 8, 2013

The fix to #76 isn't correct. It causes another error when you have an expired association:

for assoc_id, association in self.assoc.oids(server_url, handle):
expires = self.expiresIn(association)
if expires > 0:
associations.append(association)
elif expires == 0:
expired.append(association.id)

        for assoc_id, association in self.assoc.oids(server_url, handle):
            expires = self.expiresIn(association)
            if expires > 0:
                associations.append(association)
            elif expires == 0:
                expired.append(association.id)

The last line here assumes association is an Association (Django model), but it's not. It's an OpenIdAssociation, and therefore has no id member.

                expired.append(association.id)

should be:

                expired.append(assoc_id)

Traceback:

File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/social/apps/django_app/utils.py" in wrapper
  32.             return func(request, backend, *args, **kwargs)
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/social/apps/django_app/views.py" in auth
  12.     return do_auth(request.strategy, redirect_name=REDIRECT_FIELD_NAME)
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/social/actions.py" in do_auth
  25.     return strategy.start()
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/social/strategies/base.py" in start
  56.         if self.backend.uses_redirect():
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/social/backends/open_id.py" in uses_redirect
  215.         return self.openid_request().shouldSendRedirect()
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/social/backends/open_id.py" in openid_request
  221.                                          params))
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/openid/consumer/consumer.py" in begin
  353.             return self.beginWithoutDiscovery(service, anonymous)
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/openid/consumer/consumer.py" in beginWithoutDiscovery
  376.         auth_req = self.consumer.begin(service)
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/openid/consumer/consumer.py" in begin
  598.             assoc = self._getAssociation(service_endpoint)
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/openid/consumer/consumer.py" in _getAssociation
  1158.         assoc = self.store.getAssociation(endpoint.server_url)
File "/Users/kbussell/.virtualenvs/tcdc/lib/python2.7/site-packages/social/store.py" in getAssociation
  48.                 expired.append(association.id)

Exception Type: AttributeError at /user/login/yahoo/
Exception Value: 'Association' object has no attribute 'id'
@omab omab closed this as completed in a56badd Nov 8, 2013
@omab
Copy link
Owner

omab commented Nov 8, 2013

@kbussell, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants