summaryrefslogtreecommitdiff
path: root/paste/auth
diff options
context:
space:
mode:
authorCyril Roelandt <cyril.roelandt@enovance.com>2014-03-18 11:38:28 +0100
committerCyril Roelandt <cyril.roelandt@enovance.com>2014-03-18 11:38:28 +0100
commita1f64ed3c2d7942ea4b05636cd83eebf8728a183 (patch)
treee3b975b91ec124fcfdfc61fefb2253db74a26519 /paste/auth
parent4b3635c01d650058227767d2253e32e902cbbed1 (diff)
downloadpaste-a1f64ed3c2d7942ea4b05636cd83eebf8728a183.tar.gz
Python 3: Replace basestring with six.string_types
Diffstat (limited to 'paste/auth')
-rw-r--r--paste/auth/cookie.py6
-rw-r--r--paste/auth/grantip.py3
-rw-r--r--paste/auth/open_id.py3
3 files changed, 7 insertions, 5 deletions
diff --git a/paste/auth/cookie.py b/paste/auth/cookie.py
index a173f59..2c60a05 100644
--- a/paste/auth/cookie.py
+++ b/paste/auth/cookie.py
@@ -41,7 +41,7 @@ corresponding to a database session id) is stored in the cookie.
"""
-import hmac, base64, random, time, warnings
+import hmac, base64, random, six, time, warnings
try:
from hashlib import sha1
except ImportError:
@@ -124,7 +124,7 @@ class AuthCookieSigner(object):
"""
def __init__(self, secret = None, timeout = None, maxlen = None):
self.timeout = timeout or 30
- if isinstance(timeout, basestring):
+ if isinstance(timeout, six.string_types):
raise ValueError(
"Timeout must be a number (minutes), not a string (%r)"
% timeout)
@@ -370,7 +370,7 @@ def make_auth_cookie(
which is a typical browser maximum)
"""
- if isinstance(scanlist, basestring):
+ if isinstance(scanlist, six.string_types):
scanlist = scanlist.split()
if secret is None and global_conf.get('secret'):
secret = global_conf['secret']
diff --git a/paste/auth/grantip.py b/paste/auth/grantip.py
index 94b3900..4ea6df5 100644
--- a/paste/auth/grantip.py
+++ b/paste/auth/grantip.py
@@ -3,6 +3,7 @@
"""
Grant roles and logins based on IP address.
"""
+import six
from paste.util import ip4
class GrantIPMiddleware(object):
@@ -34,7 +35,7 @@ class GrantIPMiddleware(object):
self.clobber_username = clobber_username
def _convert_user_role(self, username, roles):
- if roles and isinstance(roles, basestring):
+ if roles and isinstance(roles, six.string_types):
roles = roles.split(',')
return (username, roles)
diff --git a/paste/auth/open_id.py b/paste/auth/open_id.py
index f6efe61..967e699 100644
--- a/paste/auth/open_id.py
+++ b/paste/auth/open_id.py
@@ -58,6 +58,7 @@ __all__ = ['AuthOpenIDHandler']
import cgi
import urlparse
import re
+import six
import paste.request
from paste import httpexceptions
@@ -398,7 +399,7 @@ def make_open_id_middleware(
from paste.deploy.converters import asbool
from paste.util import import_string
catch_401 = asbool(catch_401)
- if url_to_username and isinstance(url_to_username, basestring):
+ if url_to_username and isinstance(url_to_username, six.string_types):
url_to_username = import_string.eval_import(url_to_username)
apply_auth_tkt = asbool(apply_auth_tkt)
new_app = AuthOpenIDHandler(