File: __init__.py

package info (click to toggle)
python-django-debug-toolbar 1%3A1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,456 kB
  • ctags: 534
  • sloc: python: 3,073; makefile: 191; sh: 1
file content (23 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Refresh the debug toolbar's configuration when overriding settings.

from django.dispatch import receiver
from django.test.signals import setting_changed

from debug_toolbar import settings as dt_settings
from debug_toolbar.toolbar import DebugToolbar


@receiver(setting_changed)
def update_toolbar_config(**kwargs):
    if kwargs['setting'] == 'DEBUG_TOOLBAR_CONFIG':
        dt_settings.get_config.cache_clear()
        # This doesn't account for deprecated configuration options.


@receiver(setting_changed)
def update_toolbar_panels(**kwargs):
    if kwargs['setting'] == 'DEBUG_TOOLBAR_PANELS':
        dt_settings.get_panels.cache_clear()
        DebugToolbar._panel_classes = None
        # Not implemented: invalidate debug_toolbar.urls.
        # This doesn't account for deprecated panel names.