diff options
| author | Aymeric Augustin | 2013-11-24 12:27:37 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-11-24 12:27:37 +0100 | 
| commit | 6b0d32f7066cac5b6cb92e383eb486a3aa666d03 (patch) | |
| tree | dd95144a9e6272e798a7c03ef79f970b6fac7a6d /debug_toolbar/middleware.py | |
| parent | 1c1b4428642254f4e6b05e93bd135b894f708eeb (diff) | |
| download | django-debug-toolbar-6b0d32f7066cac5b6cb92e383eb486a3aa666d03.tar.bz2 | |
Fix cyclic import issues in db2de5b.
Diffstat (limited to 'debug_toolbar/middleware.py')
| -rw-r--r-- | debug_toolbar/middleware.py | 7 | 
1 files changed, 6 insertions, 1 deletions
| diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index b7114af..b58f588 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -8,6 +8,7 @@ import threading  from django.conf import settings  from django.utils.encoding import force_text +from django.utils.importlib import import_module  from debug_toolbar.toolbar import DebugToolbar  from debug_toolbar import settings as dt_settings @@ -38,7 +39,11 @@ class DebugToolbarMiddleware(object):      debug_toolbars = {}      def process_request(self, request): -        if not dt_settings.CONFIG['SHOW_TOOLBAR_CALLBACK'](request): +        func_path = dt_settings.CONFIG['SHOW_TOOLBAR_CALLBACK'] +        # Replace this with import_by_path in Django >= 1.6. +        mod_path, func_name = func_path.rsplit('.', 1) +        show_toolbar = getattr(import_module(mod_path), func_name) +        if not show_toolbar(request):              return          response = None          toolbar = DebugToolbar(request) | 
