aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/utils/settings.py
diff options
context:
space:
mode:
authorAymeric Augustin2013-11-12 22:05:52 +0100
committerAymeric Augustin2013-11-12 22:15:50 +0100
commitf48039e3bad9e24a59a25ed5636b428e11784da9 (patch)
treedbb6471cbf1ceb504d9932639b3ca40a57b89a31 /debug_toolbar/utils/settings.py
parentc1d50fc79645c71987ae156d371777dd371c422d (diff)
downloaddjango-debug-toolbar-f48039e3bad9e24a59a25ed5636b428e11784da9.tar.bz2
Move the logic to load panels inside the DebugToolbar class.
This has the additional advantage of eliminating a side-effect that happened at import time unnecessarily. It justified refactoring the way we handle settings and defaults.
Diffstat (limited to 'debug_toolbar/utils/settings.py')
-rw-r--r--debug_toolbar/utils/settings.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/debug_toolbar/utils/settings.py b/debug_toolbar/utils/settings.py
index 12dc231..45f661f 100644
--- a/debug_toolbar/utils/settings.py
+++ b/debug_toolbar/utils/settings.py
@@ -4,6 +4,13 @@ from django.conf import settings
from django.utils import six
+# Always import this module as follows:
+# from debug_toolbar.utils import settings [as dt_settings]
+
+# Don't import directly CONFIG or PANELs, or you will miss changes performed
+# with override_settings in tests.
+
+
CONFIG_DEFAULTS = {
'INTERCEPT_REDIRECTS': False,
'SHOW_TOOLBAR_CALLBACK': None,
@@ -27,3 +34,20 @@ CONFIG_DEFAULTS = {
CONFIG = {}
CONFIG.update(CONFIG_DEFAULTS)
CONFIG.update(getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {}))
+
+
+PANELS_DEFAULTS = (
+ 'debug_toolbar.panels.version.VersionDebugPanel',
+ 'debug_toolbar.panels.timer.TimerDebugPanel',
+ 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel',
+ 'debug_toolbar.panels.headers.HeaderDebugPanel',
+ 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
+ 'debug_toolbar.panels.sql.SQLDebugPanel',
+ 'debug_toolbar.panels.template.TemplateDebugPanel',
+ 'debug_toolbar.panels.cache.CacheDebugPanel',
+ 'debug_toolbar.panels.signals.SignalDebugPanel',
+ 'debug_toolbar.panels.logger.LoggingPanel',
+)
+
+
+PANELS = getattr(settings, 'DEBUG_TOOLBAR_PANELS', PANELS_DEFAULTS)