diff options
| author | Yann Malet | 2011-09-09 23:48:35 +0200 |
|---|---|---|
| committer | Yann Malet | 2011-09-09 23:48:35 +0200 |
| commit | 358d2364f95d859bf75f0194b3ea2b66642f0529 (patch) | |
| tree | 4cd6df9926be4131391f12cda77e9540aa58cee5 /debug_toolbar/middleware.py | |
| parent | 7a24088d0d4316e113387d229ed0491e31226348 (diff) | |
| download | django-debug-toolbar-358d2364f95d859bf75f0194b3ea2b66642f0529.tar.bz2 | |
Revert some of the previous changes and modify slightly the panels to separate the gneration of the stats and the generation of the content.
Diffstat (limited to 'debug_toolbar/middleware.py')
| -rw-r--r-- | debug_toolbar/middleware.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index f49a29f..1d332c0 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -5,7 +5,6 @@ import imp import thread from django.conf import settings -from django.conf.urls.defaults import include, patterns from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.utils.encoding import smart_unicode @@ -97,6 +96,7 @@ class DebugToolbarMiddleware(object): for panel in toolbar.panels: panel.process_request(request) self.__class__.debug_toolbars[thread.get_ident()] = toolbar + request.debug_toolbar = toolbar def process_view(self, request, view_func, view_args, view_kwargs): __traceback_hide__ = True @@ -124,13 +124,14 @@ class DebugToolbarMiddleware(object): ) response.cookies = cookies if 'gzip' not in response.get('Content-Encoding', '') and \ - response.get('Content-Type', '').split(';')[0] in _HTML_TYPES: + response.get('Content-Type', '').split(';')[0] in _HTML_TYPES: + toolbar.stats = {} for panel in toolbar.panels: - panel.process_response(request, response) + panel.process_response(request, response) response.content = replace_insensitive( - smart_unicode(response.content), - self.tag, - smart_unicode(toolbar.render_toolbar() + self.tag)) + smart_unicode(response.content), + self.tag, + smart_unicode(toolbar.render_toolbar() + self.tag)) if response.get('Content-Length', None): response['Content-Length'] = len(response.content) del self.__class__.debug_toolbars[ident] |
