aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/toolbar/loader.py
diff options
context:
space:
mode:
authorMatt George2008-09-29 12:30:37 -0500
committerMatt George2008-09-29 12:30:37 -0500
commit4734384cecd18ee6497730dc997aa34040975d13 (patch)
treeadbbe87fbc1f441e83ea068f19a5128fffd98f09 /debug_toolbar/toolbar/loader.py
parent2a32669822bddb31f687fcf6ca45f5d82d691e8d (diff)
parentce8c68b79c2de4abde01b29b1c73754ce4deb981 (diff)
downloaddjango-debug-toolbar-4734384cecd18ee6497730dc997aa34040975d13.tar.bz2
Merge branch 'master' of git://github.com/robhudson/django-debug-toolbar
Conflicts: debug_toolbar/templates/debug_toolbar/base.html
Diffstat (limited to 'debug_toolbar/toolbar/loader.py')
-rw-r--r--debug_toolbar/toolbar/loader.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/debug_toolbar/toolbar/loader.py b/debug_toolbar/toolbar/loader.py
index 815c7f3..ce17080 100644
--- a/debug_toolbar/toolbar/loader.py
+++ b/debug_toolbar/toolbar/loader.py
@@ -8,17 +8,31 @@ class DebugToolbar(object):
def __init__(self, request):
self.request = request
self.panels = []
- self.panel_list = []
- self.content_list = []
-
+ # Override this tuple by copying to settings.py as `DEBUG_TOOLBAR_PANELS`
+ self.default_panels = (
+ 'debug_toolbar.panels.version.VersionDebugPanel',
+ 'debug_toolbar.panels.timer.TimerDebugPanel',
+ 'debug_toolbar.panels.headers.HeaderDebugPanel',
+ 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel',
+ 'debug_toolbar.panels.sql.SQLDebugPanel',
+ 'debug_toolbar.panels.cache.CacheDebugPanel',
+ 'debug_toolbar.panels.template.TemplateDebugPanel',
+ 'debug_toolbar.panels.logger.LoggingPanel',
+ )
+ self.load_panels()
+
def load_panels(self):
"""
- Populate debug panel lists from settings.DEBUG_TOOLBAR_PANELS.
+ Populate debug panels
"""
from django.conf import settings
from django.core import exceptions
- for panel_path in settings.DEBUG_TOOLBAR_PANELS:
+ # Check if settings has a DEBUG_TOOLBAR_PANELS, otherwise use default
+ if hasattr(settings, 'DEBUG_TOOLBAR_PANELS'):
+ self.default_panels = settings.DEBUG_TOOLBAR_PANELS
+
+ for panel_path in self.default_panels:
try:
dot = panel_path.rindex('.')
except ValueError:
@@ -34,8 +48,9 @@ class DebugToolbar(object):
raise exceptions.ImproperlyConfigured, 'Toolbar Panel module "%s" does not define a "%s" class' % (panel_module, panel_classname)
try:
- panel_instance = panel_class(self.request)
+ panel_instance = panel_class()
except:
+ print panel_class
raise # Bubble up problem loading panel
self.panels.append(panel_instance)
@@ -44,4 +59,7 @@ class DebugToolbar(object):
"""
Renders the overall Toolbar with panels inside.
"""
- return render_to_string('debug_toolbar/base.html', {'panels': self.panels})
+ return render_to_string('debug_toolbar/base.html', {
+ 'panels': self.panels,
+ 'BASE_URL': self.request.META.get('SCRIPT_NAME', ''),
+ })