aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/middleware.py
diff options
context:
space:
mode:
authorRob Hudson2008-09-08 11:08:03 -0700
committerRob Hudson2008-09-08 11:08:03 -0700
commit68131cbf61cdde63d1c263ed5668f727fceb67b4 (patch)
treed7d6a2ddd610823ccfa64c80e1c0aaf9ef5fdbd2 /debug_toolbar/middleware.py
parent9ad09dc7aab671b67344d443e2baf4300ac68073 (diff)
downloaddjango-debug-toolbar-68131cbf61cdde63d1c263ed5668f727fceb67b4.tar.bz2
Rewrite of toolbar HTML, CSS, and JS. Written by David Cramer with some
tweaks. This also removes the jQuery dependency.
Diffstat (limited to 'debug_toolbar/middleware.py')
-rw-r--r--debug_toolbar/middleware.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index 8883b37..7cfaac6 100644
--- a/debug_toolbar/middleware.py
+++ b/debug_toolbar/middleware.py
@@ -8,7 +8,7 @@ from debug_toolbar.toolbar.loader import DebugToolbar
_HTML_TYPES = ('text/html', 'application/xhtml+xml')
_END_HEAD_RE = re.compile(r'</head>', re.IGNORECASE)
-_END_BODY_RE = re.compile(r'</body>', re.IGNORECASE)
+_END_BODY_RE = re.compile(r'<body([^<]*)>', re.IGNORECASE)
class DebugToolbarMiddleware(object):
"""
@@ -36,5 +36,5 @@ class DebugToolbarMiddleware(object):
if response['Content-Type'].split(';')[0] in _HTML_TYPES and not request.is_ajax():
# Saving this here in case we ever need to inject into <head>
#response.content = _END_HEAD_RE.sub(smart_str(self.debug_toolbar.render_styles() + "%s" % match.group()), response.content)
- response.content = _END_BODY_RE.sub(smart_str(self.debug_toolbar.render_toolbar() + '</body>'), response.content)
+ response.content = _END_BODY_RE.sub(smart_str('<body\\1>' + self.debug_toolbar.render_toolbar()), response.content)
return response