diff options
| author | Calvin Cheng | 2012-11-03 15:24:52 +0800 |
|---|---|---|
| committer | Calvin Cheng | 2012-11-03 15:24:52 +0800 |
| commit | f3d5bb79b0a7ceb4f507e8f68a40df408c8176d6 (patch) | |
| tree | 08d0664af82421cd675a640c11e0a2bc8bc023ba | |
| parent | 9b1fbf20728276d039f303dcb0973cbb64b26a70 (diff) | |
| download | django-debug-toolbar-f3d5bb79b0a7ceb4f507e8f68a40df408c8176d6.tar.bz2 | |
Fix unit test breakage. middleware functions are expecting threading.currentThread().ident, which is an integer, and not the threading.currentThread() instance itself.
| -rw-r--r-- | debug_toolbar/middleware.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 751185f..970d421 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -14,7 +14,7 @@ import debug_toolbar.urls from debug_toolbar.toolbar.loader import DebugToolbar _HTML_TYPES = ('text/html', 'application/xhtml+xml') -threading._DummyThread._Thread__stop = lambda x: 1 # Handles python threading module bug - http://bugs.python.org/issue14308 +#threading._DummyThread._Thread__stop = lambda x: 1 # Handles python threading module bug - http://bugs.python.org/issue14308 def replace_insensitive(string, target, replacement): @@ -39,7 +39,7 @@ class DebugToolbarMiddleware(object): @classmethod def get_current(cls): - return cls.debug_toolbars.get(threading.currentThread()) + return cls.debug_toolbars.get(threading.currentThread().ident) def __init__(self): self._urlconfs = {} @@ -99,11 +99,11 @@ class DebugToolbarMiddleware(object): toolbar = DebugToolbar(request) for panel in toolbar.panels: panel.process_request(request) - self.__class__.debug_toolbars[threading.currentThread()] = toolbar + self.__class__.debug_toolbars[threading.currentThread().ident] = toolbar def process_view(self, request, view_func, view_args, view_kwargs): __traceback_hide__ = True - toolbar = self.__class__.debug_toolbars.get(threading.currentThread()) + toolbar = self.__class__.debug_toolbars.get(threading.currentThread().ident) if not toolbar: return result = None @@ -115,7 +115,7 @@ class DebugToolbarMiddleware(object): def process_response(self, request, response): __traceback_hide__ = True - ident = threading.currentThread() + ident = threading.currentThread().ident toolbar = self.__class__.debug_toolbars.get(ident) if not toolbar or request.is_ajax(): return response |
