diff options
| author | Aymeric Augustin | 2013-11-12 22:05:52 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-11-12 22:15:50 +0100 | 
| commit | f48039e3bad9e24a59a25ed5636b428e11784da9 (patch) | |
| tree | dbb6471cbf1ceb504d9932639b3ca40a57b89a31 /tests/__init__.py | |
| parent | c1d50fc79645c71987ae156d371777dd371c422d (diff) | |
| download | django-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 'tests/__init__.py')
| -rw-r--r-- | tests/__init__.py | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/tests/__init__.py b/tests/__init__.py index 0abb8a3..b3b9440 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,7 +1,7 @@  # Refresh the debug toolbar's configuration when overriding settings. -from debug_toolbar.utils.settings import CONFIG, CONFIG_DEFAULTS -from debug_toolbar.toolbar import load_panel_classes, panel_classes  # noqa +from debug_toolbar.toolbar import DebugToolbar +from debug_toolbar.utils import settings as dt_settings  from django.dispatch import receiver  from django.test.signals import setting_changed @@ -10,13 +10,13 @@ from django.test.signals import setting_changed  @receiver(setting_changed)  def update_toolbar_config(**kwargs):      if kwargs['setting'] == 'DEBUG_TOOLBAR_CONFIG': -        CONFIG.update(CONFIG_DEFAULTS) -        CONFIG.update(kwargs['value'] or {}) +        dt_settings.CONFIG = {} +        dt_settings.CONFIG.update(dt_settings.CONFIG_DEFAULTS) +        dt_settings.CONFIG.update(kwargs['value'] or {})  @receiver(setting_changed)  def update_toolbar_panels(**kwargs):      if kwargs['setting'] == 'DEBUG_TOOLBAR_PANELS': -        global panel_classes -        panel_classes = []                                              # noqa -        load_panel_classes() +        dt_settings.PANELS = kwargs['value'] or dt_settings.PANELS_DEFAULTS +        DebugToolbar._panel_classes = None | 
