summaryrefslogtreecommitdiff
path: root/paste
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
parent4b3635c01d650058227767d2253e32e902cbbed1 (diff)
downloadpaste-a1f64ed3c2d7942ea4b05636cd83eebf8728a183.tar.gz
Python 3: Replace basestring with six.string_types
Diffstat (limited to 'paste')
-rw-r--r--paste/auth/cookie.py6
-rw-r--r--paste/auth/grantip.py3
-rw-r--r--paste/auth/open_id.py3
-rw-r--r--paste/cgitb_catcher.py2
-rw-r--r--paste/debug/prints.py3
-rw-r--r--paste/exceptions/formatter.py3
6 files changed, 12 insertions, 8 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(
diff --git a/paste/cgitb_catcher.py b/paste/cgitb_catcher.py
index 2679d81..55a346f 100644
--- a/paste/cgitb_catcher.py
+++ b/paste/cgitb_catcher.py
@@ -32,7 +32,7 @@ class CgitbMiddleware(object):
global_conf = {}
if display is NoDefault:
display = global_conf.get('debug')
- if isinstance(display, basestring):
+ if isinstance(display, six.string_types):
display = converters.asbool(display)
self.display = display
self.logdir = logdir
diff --git a/paste/debug/prints.py b/paste/debug/prints.py
index d30fc8f..6cc3f7d 100644
--- a/paste/debug/prints.py
+++ b/paste/debug/prints.py
@@ -23,6 +23,7 @@ import cgi
from paste.util import threadedprint
from paste import wsgilib
from paste import response
+import six
import sys
_threadedprint_installed = False
@@ -71,7 +72,7 @@ class PrintDebugMiddleware(object):
# the entry point
self.app = app
self.force_content_type = force_content_type
- if isinstance(print_wsgi_errors, basestring):
+ if isinstance(print_wsgi_errors, six.string_types):
from paste.deploy.converters import asbool
print_wsgi_errors = asbool(print_wsgi_errors)
self.print_wsgi_errors = print_wsgi_errors
diff --git a/paste/exceptions/formatter.py b/paste/exceptions/formatter.py
index a613479..7fa5e7d 100644
--- a/paste/exceptions/formatter.py
+++ b/paste/exceptions/formatter.py
@@ -8,6 +8,7 @@ Formatters for the exception data that comes from ExceptionCollector.
# Use this: http://www.zope.org/Members/tino/VisualTraceback/VisualTracebackNews
import cgi
+import six
import re
from paste.util import PySourceColor
@@ -76,7 +77,7 @@ class AbstractFormatter(object):
lines.append(self.format_long_source(
source, long_source))
etype = exc_data.exception_type
- if not isinstance(etype, basestring):
+ if not isinstance(etype, six.string_types):
etype = etype.__name__
exc_info = self.format_exception_info(
etype,