diff options
| author | tschilling | 2014-02-14 13:56:50 -0500 |
|---|---|---|
| committer | tschilling | 2014-02-14 14:17:26 -0500 |
| commit | 1a5108a23d97f2c6d111afaff433df64c2211955 (patch) | |
| tree | 9025b420606438078ca792be2ecafd64d78433c3 /debug_toolbar/panels | |
| parent | 06c3824c031d19013a4db8f844c503ab8e6b80ea (diff) | |
| download | django-debug-toolbar-1a5108a23d97f2c6d111afaff433df64c2211955.tar.bz2 | |
Deprecating INTERCEPT_REDIRECTS in favor of DEFAULT_DISABLED_PANELS.
Diffstat (limited to 'debug_toolbar/panels')
| -rw-r--r-- | debug_toolbar/panels/__init__.py | 10 | ||||
| -rw-r--r-- | debug_toolbar/panels/redirects.py | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 178ea6f..e71d7b6 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -4,6 +4,8 @@ import warnings from django.template.loader import render_to_string +from debug_toolbar import settings as dt_settings + class Panel(object): """ @@ -20,7 +22,13 @@ class Panel(object): @property def enabled(self): - return self.toolbar.request.COOKIES.get('djdt' + self.panel_id, 'on') == 'on' + # Check to see if settings has a default value for it + if self.panel_id in dt_settings.CONFIG['DEFAULT_DISABLED_PANELS']: + default = 'off' + else: + default = 'on' + # The user's cookies should override the default value + return self.toolbar.request.COOKIES.get('djdt' + self.panel_id, default) == 'on' # Titles and content diff --git a/debug_toolbar/panels/redirects.py b/debug_toolbar/panels/redirects.py index 8bd5aba..757c65c 100644 --- a/debug_toolbar/panels/redirects.py +++ b/debug_toolbar/panels/redirects.py @@ -12,11 +12,6 @@ class RedirectsPanel(Panel): Panel that intercepts redirects and displays a page with debug info. """ - @property - def enabled(self): - default = 'on' if self.toolbar.config['INTERCEPT_REDIRECTS'] else 'off' - return self.toolbar.request.COOKIES.get('djdt' + self.panel_id, default) == 'on' - has_content = False nav_title = _("Intercept redirects") |
