diff options
| -rw-r--r-- | debug_toolbar/panels/profiling.py | 4 | ||||
| -rw-r--r-- | debug_toolbar/utils/__init__.py | 6 | ||||
| -rw-r--r-- | tests/tests.py | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/debug_toolbar/panels/profiling.py b/debug_toolbar/panels/profiling.py index c93c3b3..6adb279 100644 --- a/debug_toolbar/panels/profiling.py +++ b/debug_toolbar/panels/profiling.py @@ -2,6 +2,7 @@ from __future__ import division, unicode_literals from django.utils.translation import ugettext_lazy as _ from django.utils.safestring import mark_safe +from django.utils.six.moves import cStringIO from debug_toolbar.panels import DebugPanel try: @@ -11,7 +12,6 @@ except ImportError: DJ_PROFILE_USE_LINE_PROFILER = False -from cStringIO import StringIO import cProfile from pstats import Stats from colorsys import hsv_to_rgb @@ -128,7 +128,7 @@ class FunctionCall(object): if self._line_stats_text is None and DJ_PROFILE_USE_LINE_PROFILER: lstats = self.statobj.line_stats if self.func in lstats.timings: - out = StringIO() + out = cStringIO.StringIO() fn, lineno, name = self.func show_func(fn, lineno, name, lstats.timings[self.func], lstats.unit, stream=out) self._line_stats_text = out.getvalue() diff --git a/debug_toolbar/utils/__init__.py b/debug_toolbar/utils/__init__.py index 7efb106..ebd8b84 100644 --- a/debug_toolbar/utils/__init__.py +++ b/debug_toolbar/utils/__init__.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import inspect import os.path import django -import SocketServer import sys from django.conf import settings @@ -11,10 +10,11 @@ from django.views.debug import linebreak_iter from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils import six +from django.utils.six.moves import socketserver # Figure out some paths django_path = os.path.realpath(os.path.dirname(django.__file__)) -socketserver_path = os.path.realpath(os.path.dirname(SocketServer.__file__)) +socketserver_path = os.path.realpath(os.path.dirname(socketserver.__file__)) def ms_from_timedelta(td): @@ -31,7 +31,7 @@ def tidy_stacktrace(stack): """ Clean up stacktrace and remove all entries that: 1. Are part of Django (except contrib apps) - 2. Are part of SocketServer (used by Django's dev server) + 2. Are part of socketserver (used by Django's dev server) 3. Are the last entry (which is part of our stacktracing code) ``stack`` should be a list of frame tuples from ``inspect.stack()`` diff --git a/tests/tests.py b/tests/tests.py index def4f8c..cdf1a9e 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -1,5 +1,4 @@ from __future__ import unicode_literals -import thread import django from django.conf import settings @@ -9,6 +8,7 @@ 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.six.moves import _thread from django.utils import unittest from debug_toolbar.middleware import DebugToolbarMiddleware @@ -50,7 +50,7 @@ class BaseTestCase(TestCase): response = HttpResponse() toolbar = DebugToolbar(request) - DebugToolbarMiddleware.debug_toolbars[thread.get_ident()] = toolbar + DebugToolbarMiddleware.debug_toolbars[_thread.get_ident()] = toolbar self.request = request self.response = response |
