14
14
from debug_toolbar .toolbar .loader import DebugToolbar
15
15
16
16
_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
18
18
19
19
20
20
def replace_insensitive (string , target , replacement ):
@@ -39,7 +39,7 @@ class DebugToolbarMiddleware(object):
39
39
40
40
@classmethod
41
41
def get_current (cls ):
42
- return cls .debug_toolbars .get (threading .currentThread ())
42
+ return cls .debug_toolbars .get (threading .currentThread (). ident )
43
43
44
44
def __init__ (self ):
45
45
self ._urlconfs = {}
@@ -99,11 +99,11 @@ def process_request(self, request):
99
99
toolbar = DebugToolbar (request )
100
100
for panel in toolbar .panels :
101
101
panel .process_request (request )
102
- self .__class__ .debug_toolbars [threading .currentThread ()] = toolbar
102
+ self .__class__ .debug_toolbars [threading .currentThread (). ident ] = toolbar
103
103
104
104
def process_view (self , request , view_func , view_args , view_kwargs ):
105
105
__traceback_hide__ = True
106
- toolbar = self .__class__ .debug_toolbars .get (threading .currentThread ())
106
+ toolbar = self .__class__ .debug_toolbars .get (threading .currentThread (). ident )
107
107
if not toolbar :
108
108
return
109
109
result = None
@@ -115,7 +115,7 @@ def process_view(self, request, view_func, view_args, view_kwargs):
115
115
116
116
def process_response (self , request , response ):
117
117
__traceback_hide__ = True
118
- ident = threading .currentThread ()
118
+ ident = threading .currentThread (). ident
119
119
toolbar = self .__class__ .debug_toolbars .get (ident )
120
120
if not toolbar or request .is_ajax ():
121
121
return response
0 commit comments