Skip to content

Commit f3d5bb7

Browse files
committed
Fix unit test breakage. middleware functions are expecting threading.currentThread().ident, which is an integer, and not the threading.currentThread() instance itself.
1 parent 9b1fbf2 commit f3d5bb7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

debug_toolbar/middleware.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from debug_toolbar.toolbar.loader import DebugToolbar
1515

1616
_HTML_TYPES = ('text/html', 'application/xhtml+xml')
17-
threading._DummyThread._Thread__stop = lambda x: 1 # Handles python threading module bug - http://bugs.python.org/issue14308
17+
#threading._DummyThread._Thread__stop = lambda x: 1 # Handles python threading module bug - http://bugs.python.org/issue14308
1818

1919

2020
def replace_insensitive(string, target, replacement):
@@ -39,7 +39,7 @@ class DebugToolbarMiddleware(object):
3939

4040
@classmethod
4141
def get_current(cls):
42-
return cls.debug_toolbars.get(threading.currentThread())
42+
return cls.debug_toolbars.get(threading.currentThread().ident)
4343

4444
def __init__(self):
4545
self._urlconfs = {}
@@ -99,11 +99,11 @@ def process_request(self, request):
9999
toolbar = DebugToolbar(request)
100100
for panel in toolbar.panels:
101101
panel.process_request(request)
102-
self.__class__.debug_toolbars[threading.currentThread()] = toolbar
102+
self.__class__.debug_toolbars[threading.currentThread().ident] = toolbar
103103

104104
def process_view(self, request, view_func, view_args, view_kwargs):
105105
__traceback_hide__ = True
106-
toolbar = self.__class__.debug_toolbars.get(threading.currentThread())
106+
toolbar = self.__class__.debug_toolbars.get(threading.currentThread().ident)
107107
if not toolbar:
108108
return
109109
result = None
@@ -115,7 +115,7 @@ def process_view(self, request, view_func, view_args, view_kwargs):
115115

116116
def process_response(self, request, response):
117117
__traceback_hide__ = True
118-
ident = threading.currentThread()
118+
ident = threading.currentThread().ident
119119
toolbar = self.__class__.debug_toolbars.get(ident)
120120
if not toolbar or request.is_ajax():
121121
return response

0 commit comments

Comments
 (0)