Commits

Wei Cheng Pan committed d18f55e

Fix basestring type name.

Comments (0)

Files changed (1)

beproud/django/ssl/middleware.py

 # vim:fileencoding=utf8
+import sys
 import re
 
+if sys.version_info >= (3,):
+    basestring = ( str, bytes )
+
 from django.http import HttpResponseRedirect, Http404
 from django.conf import settings as django_settings
 from django.core import urlresolvers
     def __init__(self, urls=None, ignore_urls=None):
         if not urls:
             urls = settings.SSL_URLS
-        self.urls = [re.compile(u) if isinstance(u, str) else u for u in urls]
+        self.urls = [re.compile(u) if isinstance(u, basestring) else u for u in urls]
         if not ignore_urls:
             ignore_urls = settings.SSL_IGNORE_URLS
-        self.ignore_urls = [re.compile(u) if isinstance(u, str) else u for u in ignore_urls]
+        self.ignore_urls = [re.compile(u) if isinstance(u, basestring) else u for u in ignore_urls]
 
     def is_handle_url(self, request):
         """