aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/panels/__init__.py
diff options
context:
space:
mode:
authorChris Adams2010-01-14 08:02:49 -0800
committerRob Hudson2010-01-14 08:02:49 -0800
commit4baa51e0be674428a2314e08efe43628184bc42a (patch)
treed3584431a61ad1fbdf885e024950f472b89ff21e /debug_toolbar/panels/__init__.py
parentfba93b813f90430545d5acaa25ef218f792360ab (diff)
downloaddjango-debug-toolbar-4baa51e0be674428a2314e08efe43628184bc42a.tar.bz2
Template panel context cleanup.
All panels get a copy of the template context when created and use an updated copy when rendering so they can have full access to context vars and avoid making changes to the shared context. Signed-off-by: Rob Hudson <rob@cogit8.org>
Diffstat (limited to 'debug_toolbar/panels/__init__.py')
-rw-r--r--debug_toolbar/panels/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py
index cf65aa8..fa2e4b6 100644
--- a/debug_toolbar/panels/__init__.py
+++ b/debug_toolbar/panels/__init__.py
@@ -7,9 +7,13 @@ class DebugPanel(object):
# name = Base
has_content = False # If content returns something, set to true in subclass
+ # We'll maintain a local context instance so we can expose our template
+ # context variables to panels which need them:
+ context = {}
+
# Panel methods
- def __init__(self):
- pass
+ def __init__(self, context={}):
+ self.context.update(context)
def dom_id(self):
return 'djDebug%sPanel' % (self.name.replace(' ', ''))