diff options
| -rw-r--r-- | debug_toolbar/middleware.py | 3 | ||||
| -rw-r--r-- | debug_toolbar/utils/tracking/db.py | 3 | ||||
| -rw-r--r-- | tests/tests.py | 9 | 
3 files changed, 9 insertions, 6 deletions
| diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 520a81e..c361a49 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -12,6 +12,7 @@ from django.http import HttpResponseRedirect  from django.shortcuts import render_to_response  from django.utils.encoding import force_text  from django.utils.importlib import import_module +from django.utils import six  import debug_toolbar.urls  from debug_toolbar.toolbar.loader import DebugToolbar @@ -80,7 +81,7 @@ class DebugToolbarMiddleware(object):          __traceback_hide__ = True          if self.show_toolbar(request):              urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF) -            if isinstance(urlconf, basestring): +            if isinstance(urlconf, six.string_types):                  urlconf = import_module(getattr(request, 'urlconf', settings.ROOT_URLCONF))              if urlconf not in self._urlconfs: diff --git a/debug_toolbar/utils/tracking/db.py b/debug_toolbar/utils/tracking/db.py index 34adfae..f87f01c 100644 --- a/debug_toolbar/utils/tracking/db.py +++ b/debug_toolbar/utils/tracking/db.py @@ -9,6 +9,7 @@ from threading import local  from django.conf import settings  from django.template import Node  from django.utils.encoding import force_text +from django.utils import six  from debug_toolbar.utils import ms_from_timedelta, tidy_stacktrace, \                                  get_template_info, get_stack @@ -72,7 +73,7 @@ class NormalCursorWrapper(object):          self.logger = logger      def _quote_expr(self, element): -        if isinstance(element, basestring): +        if isinstance(element, six.string_types):              element = element.replace("'", "''")              return "'%s'" % element          else: diff --git a/tests/tests.py b/tests/tests.py index 5dcb034..def4f8c 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -8,6 +8,7 @@ from django.db import connection  from django.http import HttpResponse  from django.test import TestCase, RequestFactory  from django.template import Template, Context +from django.utils import six  from django.utils import unittest  from debug_toolbar.middleware import DebugToolbarMiddleware @@ -105,7 +106,7 @@ class DebugToolbarTestCase(BaseTestCase):          with Settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True):              middleware.process_request(request) -            self.assertFalse(isinstance(request.urlconf, basestring)) +            self.assertFalse(isinstance(request.urlconf, six.string_types))              self.assertTrue(hasattr(request.urlconf.urlpatterns[1], '_callback_str'))              self.assertEquals(request.urlconf.urlpatterns[-1]._callback_str, 'tests.views.execute_sql') @@ -120,7 +121,7 @@ class DebugToolbarTestCase(BaseTestCase):              request.urlconf = 'tests.urls'              middleware.process_request(request) -            self.assertFalse(isinstance(request.urlconf, basestring)) +            self.assertFalse(isinstance(request.urlconf, six.string_types))              self.assertTrue(hasattr(request.urlconf.urlpatterns[1], '_callback_str'))              self.assertEquals(request.urlconf.urlpatterns[-1]._callback_str, 'tests.views.execute_sql') @@ -133,7 +134,7 @@ class DebugToolbarTestCase(BaseTestCase):          with Settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True):              middleware.process_request(request) -            self.assertFalse(isinstance(request.urlconf, basestring)) +            self.assertFalse(isinstance(request.urlconf, six.string_types))              self.assertTrue(hasattr(request.urlconf.urlpatterns[1], '_callback_str'))              self.assertEquals(request.urlconf.urlpatterns[-1]._callback_str, 'tests.views.execute_sql') @@ -146,7 +147,7 @@ class DebugToolbarTestCase(BaseTestCase):          middleware = DebugToolbarMiddleware()          with Settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True):              middleware.process_request(request) -            self.assertFalse(isinstance(request.urlconf, basestring)) +            self.assertFalse(isinstance(request.urlconf, six.string_types))      def _resolve_stats(self, path):          # takes stats from RequestVars panel | 
