aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/toolbar.py
diff options
context:
space:
mode:
authorAymeric Augustin2013-11-29 22:22:38 +0100
committerAymeric Augustin2013-11-29 22:24:09 +0100
commitc33ce081f270b43fffe8af33bf50ae821aa12fcf (patch)
tree4057ccbd22201dd977cd3b1c945aabe27728d454 /debug_toolbar/toolbar.py
parentc12de857b96960bdb506d084b186b62e0c4bd292 (diff)
downloaddjango-debug-toolbar-c33ce081f270b43fffe8af33bf50ae821aa12fcf.tar.bz2
Stop sharing unsafely a context dict across threads.
Panels that need to share data with other panels shall do it through the record_stats / get_stats API. Statistics are automatically pushed to the template context. Fix #450.
Diffstat (limited to 'debug_toolbar/toolbar.py')
-rw-r--r--debug_toolbar/toolbar.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py
index d50ad52..80b6dff 100644
--- a/debug_toolbar/toolbar.py
+++ b/debug_toolbar/toolbar.py
@@ -20,10 +20,9 @@ class DebugToolbar(object):
def __init__(self, request):
self.request = request
self.config = dt_settings.CONFIG.copy()
- self.template_context = {'toolbar': self}
self._panels = SortedDict()
for panel_class in self.get_panel_classes():
- panel_instance = panel_class(self, context=self.template_context)
+ panel_instance = panel_class(self)
self._panels[panel_instance.panel_id] = panel_instance
self.stats = {}
self.store_id = None
@@ -58,8 +57,7 @@ class DebugToolbar(object):
"""
if not self.should_render_panels():
self.store()
- context = self.template_context.copy()
- return render_to_string('debug_toolbar/base.html', context)
+ return render_to_string('debug_toolbar/base.html', {'toolbar': self})
# Handle storing toolbars in memory and fetching them later on