~ubuntuone-pqm-team/django-openid-auth/trunk

« back to all changes in this revision

Viewing changes to django_openid_auth/store.py

  • Committer: Ricardo Kirkner
  • Date: 2017-03-31 17:25:44 UTC
  • mto: This revision was merged to the branch mainline in revision 128.
  • Revision ID: ricardo.kirkner@canonical.com-20170331172544-iwtx4l1jisbhiw5v
support python 2.7 and 3.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
from openid.store.interface import OpenIDStore
37
37
from openid.store.nonce import SKEW
38
38
 
 
39
from django_openid_auth import PY3
39
40
from django_openid_auth.models import Association, Nonce
40
41
 
41
42
 
75
76
        expired = []
76
77
        for assoc in assocs:
77
78
            association = OIDAssociation(
78
 
                assoc.handle, base64.decodestring(assoc.secret), assoc.issued,
79
 
                assoc.lifetime, assoc.assoc_type
 
79
                assoc.handle,
 
80
                base64.decodestring(assoc.secret.encode('utf-8')),
 
81
                assoc.issued, assoc.lifetime, assoc.assoc_type
80
82
            )
81
 
            if association.getExpiresIn() == 0:
 
83
            if PY3:
 
84
                expires_in = association.expiresIn
 
85
            else:
 
86
                expires_in = association.getExpiresIn()
 
87
            if expires_in == 0:
82
88
                expired.append(assoc)
83
89
            else:
84
90
                associations.append((association.issued, association))