Skip to content

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

@kbussell

Description

@kbussell

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions