aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/middleware.py
diff options
context:
space:
mode:
authorDavid Cramer2011-04-22 13:00:51 -0700
committerDavid Cramer2011-04-22 13:00:51 -0700
commitc2ab3cc4f8f86cc0e2705be0cc479572092f8060 (patch)
tree4465e2f77c12a590e1ccd92ce04d41b24a983e11 /debug_toolbar/middleware.py
parent3d88525fe7d64e5ed3c4e8a5056a6d0dd8224300 (diff)
parentf3a9b2b58bb468f65a5d5de2a5f8cb4b5ffe8b67 (diff)
downloaddjango-debug-toolbar-c2ab3cc4f8f86cc0e2705be0cc479572092f8060.tar.bz2
Merge branch 'develop' of git://github.com/robhudson/django-debug-toolbar into robhudson-develop
Conflicts: debug_toolbar/media/debug_toolbar/css/toolbar.css debug_toolbar/media/debug_toolbar/css/toolbar.min.css debug_toolbar/media/debug_toolbar/js/toolbar.min.js debug_toolbar/middleware.py debug_toolbar/panels/sql.py debug_toolbar/templates/debug_toolbar/base.html debug_toolbar/templates/debug_toolbar/panels/sql.html
Diffstat (limited to 'debug_toolbar/middleware.py')
-rw-r--r--debug_toolbar/middleware.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index 446bc38..be03038 100644
--- a/debug_toolbar/middleware.py
+++ b/debug_toolbar/middleware.py
@@ -1,7 +1,6 @@
"""
Debug Toolbar middleware
"""
-import os
import thread
from django.conf import settings
@@ -111,14 +110,14 @@ class DebugToolbarMiddleware(object):
{'redirect_to': redirect_to}
)
response.cookies = cookies
- if response.status_code == 200:
+ if response.status_code == 200 and 'gzip' not in response.get('Content-Encoding', '') and \
+ response['Content-Type'].split(';')[0] in _HTML_TYPES:
for panel in toolbar.panels:
panel.process_response(request, response)
- if response['Content-Type'].split(';')[0] in _HTML_TYPES:
- response.content = replace_insensitive(
- smart_unicode(response.content),
- self.tag,
- smart_unicode(toolbar.render_toolbar() + self.tag))
+ response.content = replace_insensitive(
+ 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]