aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAymeric Augustin2013-10-17 09:22:46 +0200
committerAymeric Augustin2013-10-17 18:24:58 +0200
commitd851a3c8a6bb2b1e8c8cc4f8d6cba0f4a2abe216 (patch)
treeb32f29a250e0dae9016e500ccaea5c37ba68f4b9
parent06c01648909072aec715535cfa796b58ce287e21 (diff)
downloaddjango-debug-toolbar-d851a3c8a6bb2b1e8c8cc4f8d6cba0f4a2abe216.tar.bz2
Update usage of the threading module.
-rw-r--r--debug_toolbar/middleware.py8
-rw-r--r--tests/tests.py5
2 files changed, 7 insertions, 6 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index c361a49..6512de6 100644
--- a/debug_toolbar/middleware.py
+++ b/debug_toolbar/middleware.py
@@ -43,7 +43,7 @@ class DebugToolbarMiddleware(object):
@classmethod
def get_current(cls):
- return cls.debug_toolbars.get(threading.currentThread().ident)
+ return cls.debug_toolbars.get(threading.current_thread().ident)
def __init__(self):
self._urlconfs = {}
@@ -103,11 +103,11 @@ class DebugToolbarMiddleware(object):
toolbar = DebugToolbar(request)
for panel in toolbar.panels:
panel.process_request(request)
- self.__class__.debug_toolbars[threading.currentThread().ident] = toolbar
+ self.__class__.debug_toolbars[threading.current_thread().ident] = toolbar
def process_view(self, request, view_func, view_args, view_kwargs):
__traceback_hide__ = True
- toolbar = self.__class__.debug_toolbars.get(threading.currentThread().ident)
+ toolbar = self.__class__.debug_toolbars.get(threading.current_thread().ident)
if not toolbar:
return
result = None
@@ -119,7 +119,7 @@ class DebugToolbarMiddleware(object):
def process_response(self, request, response):
__traceback_hide__ = True
- ident = threading.currentThread().ident
+ ident = threading.current_thread().ident
toolbar = self.__class__.debug_toolbars.get(ident)
if not toolbar or request.is_ajax() or getattr(response, 'streaming', False):
return response
diff --git a/tests/tests.py b/tests/tests.py
index 67b67bf..32f8d6b 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -1,5 +1,7 @@
from __future__ import unicode_literals
+import threading
+
import django
from django.conf import settings
from django.contrib.auth.models import User
@@ -8,7 +10,6 @@ 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 +51,7 @@ class BaseTestCase(TestCase):
response = HttpResponse()
toolbar = DebugToolbar(request)
- DebugToolbarMiddleware.debug_toolbars[_thread.get_ident()] = toolbar
+ DebugToolbarMiddleware.debug_toolbars[threading.current_thread().ident] = toolbar
self.request = request
self.response = response