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

« back to all changes in this revision

Viewing changes to django_openid_auth/teams.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:
72
72
    registerNamespaceAlias,
73
73
    NamespaceAliasRegistrationError,
74
74
)
 
75
from six import string_types
75
76
 
76
77
__all__ = [
77
78
    'TeamsRequest',
84
85
 
85
86
try:
86
87
    registerNamespaceAlias(ns_uri, 'lp')
87
 
except NamespaceAliasRegistrationError, e:
 
88
except NamespaceAliasRegistrationError as e:
88
89
    oidutil.log(
89
90
        'registerNamespaceAlias(%r, %r) failed: %s' % (ns_uri, 'lp', str(e)))
90
91
 
139
140
        # There is no alias, so try to add one. (OpenID version 1)
140
141
        try:
141
142
            message.namespaces.addAlias(ns_uri, 'lp')
142
 
        except KeyError, why:
 
143
        except KeyError as why:
143
144
            # An alias for the string 'lp' already exists, but it's
144
145
            # defined for something other than Launchpad teams
145
146
            raise TeamsNamespaceError(why[0])
287
288
        @raise ValueError: when a team requested is not a string
288
289
            or strict is set and a team was requested more than once
289
290
        """
290
 
        if isinstance(query_membership, basestring):
 
291
        if isinstance(query_membership, string_types):
291
292
            raise TypeError('Teams should be passed as a list of '
292
293
                            'strings (not %r)' % (type(query_membership),))
293
294