diff options
author | Clint Byrum <clint@fewbar.com> | 2015-05-27 00:11:32 -0700 |
---|---|---|
committer | Clint Byrum <clint@fewbar.com> | 2015-05-28 09:50:57 -0700 |
commit | c76eaf78fe8000efa951a3c75ede1a32beb3c9a4 (patch) | |
tree | 42e616826e50434a78c8949645255175819d1578 /src | |
parent | ed5d61787ee45b7eb18631aa0d0eb15af75daf22 (diff) | |
download | pysaml2-c76eaf78fe8000efa951a3c75ede1a32beb3c9a4.tar.gz |
Fix more renamed modules/functions for py3
In doing so it was discovered that the 'implements' function has been
replaced by a class decorator, which must be used in python3.
Also commented out method arguments seem to expose internal py.test
problems in python3. Removing them seems fine since we can look in
revision history if we need to find the exact way it was used before.
Diffstat (limited to 'src')
-rw-r--r-- | src/saml2/discovery.py | 4 | ||||
-rw-r--r-- | src/saml2/ecp_client.py | 2 | ||||
-rw-r--r-- | src/saml2/httputil.py | 5 | ||||
-rw-r--r-- | src/saml2/pack.py | 9 | ||||
-rw-r--r-- | src/saml2/s2repoze/plugins/sp.py | 8 |
5 files changed, 12 insertions, 16 deletions
diff --git a/src/saml2/discovery.py b/src/saml2/discovery.py index 5d89f6b7..cef8ff34 100644 --- a/src/saml2/discovery.py +++ b/src/saml2/discovery.py @@ -1,6 +1,4 @@ -from urllib import urlencode -from urlparse import parse_qs -from urlparse import urlparse +from six.moves.urllib.parse import urlencode, parse_qs, urlparse from saml2.entity import Entity from saml2.response import VerificationError diff --git a/src/saml2/ecp_client.py b/src/saml2/ecp_client.py index d3dd757d..c41a046a 100644 --- a/src/saml2/ecp_client.py +++ b/src/saml2/ecp_client.py @@ -7,7 +7,7 @@ Contains a class that can do SAML ECP Authentication for other python programs. """ -import cookielib +from six.moves import http_cookiejar as cookielib import logging from saml2 import soap diff --git a/src/saml2/httputil.py b/src/saml2/httputil.py index 88c8f391..360982d5 100644 --- a/src/saml2/httputil.py +++ b/src/saml2/httputil.py @@ -5,9 +5,8 @@ import time import cgi import six -from urllib import quote -from urlparse import parse_qs -from Cookie import SimpleCookie +from six.moves.urllib.parse import quote, parse_qs +from six.moves.http_cookies import SimpleCookie from saml2 import BINDING_HTTP_ARTIFACT, SAMLError from saml2 import BINDING_HTTP_REDIRECT diff --git a/src/saml2/pack.py b/src/saml2/pack.py index 43cfadc6..b2c9c45f 100644 --- a/src/saml2/pack.py +++ b/src/saml2/pack.py @@ -10,10 +10,9 @@ Bindings normally consists of three parts: - how to package the information - which protocol to use """ -from six.moves.urllib.parse import urlparse +from six.moves.urllib.parse import urlparse, urlencode import saml2 import base64 -import urllib from saml2.s_utils import deflate_and_base64_encode from saml2.s_utils import Unsupported import logging @@ -126,12 +125,12 @@ def http_redirect_message(message, location, relay_state="", typ="SAMLRequest", except: raise Unsupported("Signing algorithm") else: - string = "&".join([urllib.urlencode({k: args[k]}) + string = "&".join([urlencode({k: args[k]}) for k in _order if k in args]) args["Signature"] = base64.b64encode(signer.sign(string, key)) - string = urllib.urlencode(args) + string = urlencode(args) else: - string = urllib.urlencode(args) + string = urlencode(args) glue_char = "&" if urlparse(location).query else "?" login_url = glue_char.join([location, string]) diff --git a/src/saml2/s2repoze/plugins/sp.py b/src/saml2/s2repoze/plugins/sp.py index 63d4f663..190caab2 100644 --- a/src/saml2/s2repoze/plugins/sp.py +++ b/src/saml2/s2repoze/plugins/sp.py @@ -13,11 +13,11 @@ import shelve import traceback import saml2 import six -from urlparse import parse_qs, urlparse +from six.moves.urllib.parse import parse_qs, urlparse from saml2.samlp import Extensions from saml2 import xmldsig as ds -from StringIO import StringIO +from six import StringIO from paste.httpexceptions import HTTPSeeOther, HTTPRedirection from paste.httpexceptions import HTTPNotImplemented @@ -27,7 +27,7 @@ from paste.request import construct_url from saml2.extension.pefim import SPCertEnc from saml2.httputil import SeeOther from saml2.client_base import ECP_SERVICE -from zope.interface import implements +from zope.interface import implementer from repoze.who.interfaces import IChallenger, IIdentifier, IAuthenticator from repoze.who.interfaces import IMetadataProvider @@ -80,8 +80,8 @@ class ECP_response(object): return [self.content] +@implementer(IChallenger, IIdentifier, IAuthenticator, IMetadataProvider) class SAML2Plugin(object): - implements(IChallenger, IIdentifier, IAuthenticator, IMetadataProvider) def __init__(self, rememberer_name, config, saml_client, wayf, cache, sid_store=None, discovery="", idp_query_param="", |