diff options
| author | tschilling | 2014-02-15 08:59:20 -0500 |
|---|---|---|
| committer | tschilling | 2014-02-15 08:59:20 -0500 |
| commit | cc08c0d19bd5d1c7ff2281e3c3e4d92fa932e6d5 (patch) | |
| tree | 8f73b3d7dfb0c603aacf034e53d95ecaa7210a85 /debug_toolbar | |
| parent | 1a5108a23d97f2c6d111afaff433df64c2211955 (diff) | |
| download | django-debug-toolbar-cc08c0d19bd5d1c7ff2281e3c3e4d92fa932e6d5.tar.bz2 | |
Changing the collection to be fully qualified names and for it to be a set not a tuple.
Diffstat (limited to 'debug_toolbar')
| -rw-r--r-- | debug_toolbar/panels/__init__.py | 3 | ||||
| -rw-r--r-- | debug_toolbar/settings.py | 23 |
2 files changed, 17 insertions, 9 deletions
diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index e71d7b6..a7e3528 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -5,6 +5,7 @@ import warnings from django.template.loader import render_to_string from debug_toolbar import settings as dt_settings +from debug_toolbar.utils import get_name_from_obj class Panel(object): @@ -23,7 +24,7 @@ class Panel(object): @property def enabled(self): # Check to see if settings has a default value for it - if self.panel_id in dt_settings.CONFIG['DEFAULT_DISABLED_PANELS']: + if get_name_from_obj(self) in dt_settings.CONFIG['DEFAULT_DISABLED_PANELS']: default = 'off' else: default = 'on' diff --git a/debug_toolbar/settings.py b/debug_toolbar/settings.py index 2d02aa5..0ea75ab 100644 --- a/debug_toolbar/settings.py +++ b/debug_toolbar/settings.py @@ -16,7 +16,7 @@ from django.utils import six CONFIG_DEFAULTS = { # Toolbar options - 'DEFAULT_DISABLED_PANELS': ('RedirectsPanel', ), + 'DEFAULT_DISABLED_PANELS': {'debug_toolbar.panels.redirects.RedirectsPanel'}, 'INSERT_BEFORE': '</body>', 'RENDER_PANELS': None, 'RESULTS_STORE_SIZE': 10, @@ -131,15 +131,22 @@ if 'INTERCEPT_REDIRECTS' in USER_CONFIG: "DEFAULT_DISABLED_PANELS config in the" "DEBUG_TOOLBAR_CONFIG setting.", DeprecationWarning) if USER_CONFIG['INTERCEPT_REDIRECTS']: - if 'RedirectsPanel' in CONFIG['DEFAULT_DISABLED_PANELS']: + if 'debug_toolbar.panels.redirects.RedirectsPanel' \ + in CONFIG['DEFAULT_DISABLED_PANELS']: # RedirectsPanel should be enabled - CONFIG['DEFAULT_DISABLED_PANELS'] = [ - panel for panel in CONFIG['DEFAULT_DISABLED_PANELS'] - if panel != "RedirectsPanel" - ] - elif not 'RedirectsPanel' in CONFIG['DEFAULT_DISABLED_PANELS']: + try: + CONFIG['DEFAULT_DISABLED_PANELS'].remove( + 'debug_toolbar.panels.redirects.RedirectsPanel' + ) + except KeyError: + # We wanted to remove it, but it didn't exist. This is fine + pass + elif not 'debug_toolbar.panels.redirects.RedirectsPanel' \ + in CONFIG['DEFAULT_DISABLED_PANELS']: # RedirectsPanel should be disabled - CONFIG['DEFAULT_DISABLED_PANELS'].append('RedirectsPanel') + CONFIG['DEFAULT_DISABLED_PANELS'].add( + 'debug_toolbar.panels.redirects.RedirectsPanel' + ) PATCH_SETTINGS = getattr(settings, 'DEBUG_TOOLBAR_PATCH_SETTINGS', settings.DEBUG) |
