aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/middleware.py
diff options
context:
space:
mode:
authorAymeric Augustin2013-10-27 12:48:44 +0100
committerAymeric Augustin2013-10-27 12:48:44 +0100
commit9cb9796791062c9d208c0f887dc65142d42c022a (patch)
tree40ba69bec7f39115ccfcc88c5b1cfa2baf2f86ea /debug_toolbar/middleware.py
parentc710140a15222af2cf31b7579c6a5fedf9a482d5 (diff)
downloaddjango-debug-toolbar-9cb9796791062c9d208c0f887dc65142d42c022a.tar.bz2
Centralize access to config and default values.
Diffstat (limited to 'debug_toolbar/middleware.py')
-rw-r--r--debug_toolbar/middleware.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index 2c47227..76402bd 100644
--- a/debug_toolbar/middleware.py
+++ b/debug_toolbar/middleware.py
@@ -16,6 +16,7 @@ from django.utils import six
import debug_toolbar.urls
from debug_toolbar.toolbar.loader import DebugToolbar
+from debug_toolbar.utils.settings import CONFIG
_HTML_TYPES = ('text/html', 'application/xhtml+xml')
# Handles python threading module bug - http://bugs.python.org/issue14308
@@ -60,21 +61,11 @@ class DebugToolbarMiddleware(object):
def __init__(self):
self._urlconfs = {}
- # Set method to use to decide to show toolbar
- self.show_toolbar = show_toolbar
+ # The method to call to decide to show the toolbar
+ self.show_toolbar = CONFIG['SHOW_TOOLBAR_CALLBACK'] or show_toolbar
# The tag to attach the toolbar to
- self.tag = '</body>'
-
- if hasattr(settings, 'DEBUG_TOOLBAR_CONFIG'):
- show_toolbar_callback = settings.DEBUG_TOOLBAR_CONFIG.get(
- 'SHOW_TOOLBAR_CALLBACK', None)
- if show_toolbar_callback:
- self.show_toolbar = show_toolbar_callback
-
- tag = settings.DEBUG_TOOLBAR_CONFIG.get('TAG', None)
- if tag:
- self.tag = '</' + tag + '>'
+ self.tag = '</%s>' % CONFIG['TAG']
def process_request(self, request):
__traceback_hide__ = True # noqa