aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/middleware.py
diff options
context:
space:
mode:
authorDavid Cramer2012-01-12 19:13:47 -0800
committerDavid Cramer2012-01-12 19:13:47 -0800
commit01cd08518ded622d3308dd539b00ebbf7012894e (patch)
treea9cca14ff92d4602a51d4999430574587a733d1d /debug_toolbar/middleware.py
parentc4eeef24faa81e7bc64ebfbd72c046f25c7b3381 (diff)
downloaddjango-debug-toolbar-01cd08518ded622d3308dd539b00ebbf7012894e.tar.bz2
pep8
Diffstat (limited to 'debug_toolbar/middleware.py')
-rw-r--r--debug_toolbar/middleware.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index 8f0445a..3009b5f 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
@@ -16,6 +15,7 @@ from debug_toolbar.toolbar.loader import DebugToolbar
_HTML_TYPES = ('text/html', 'application/xhtml+xml')
+
def replace_insensitive(string, target, replacement):
"""
Similar to string.replace() but is case insensitive
@@ -25,9 +25,10 @@ def replace_insensitive(string, target, replacement):
index = no_case.rfind(target.lower())
if index >= 0:
return string[:index] + replacement + string[index + len(target):]
- else: # no results so return the original string
+ else: # no results so return the original string
return string
+
class DebugToolbarMiddleware(object):
"""
Middleware to set up Debug Toolbar on incoming request and render toolbar
@@ -43,10 +44,10 @@ class DebugToolbarMiddleware(object):
self._urlconfs = {}
# Set method to use to decide to show toolbar
- self.show_toolbar = self._show_toolbar # default
+ self.show_toolbar = self._show_toolbar # default
# The tag to attach the toolbar to
- self.tag= u'</body>'
+ self.tag = u'</body>'
if hasattr(settings, 'DEBUG_TOOLBAR_CONFIG'):
show_toolbar_callback = settings.DEBUG_TOOLBAR_CONFIG.get(