diff options
| author | Aymeric Augustin | 2013-12-15 13:06:16 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-12-15 13:06:16 +0100 | 
| commit | 5360a2ba9c5b866ce2502aa43606b2647acea63b (patch) | |
| tree | a329bde5cc206f57ac142cef8adba456b5e4b709 /debug_toolbar/panels/templates/panel.py | |
| parent | dbed3e7c72f930c285f17206879f6bd1d46f67a1 (diff) | |
| download | django-debug-toolbar-5360a2ba9c5b866ce2502aa43606b2647acea63b.tar.bz2 | |
Properly disable instrumentation for the template panel.
It's important to disconnect the signal at the end of a request because
the toolbar now stores panels for past request.
Fix #491 (presumably).
Diffstat (limited to 'debug_toolbar/panels/templates/panel.py')
| -rw-r--r-- | debug_toolbar/panels/templates/panel.py | 10 | 
1 files changed, 6 insertions, 4 deletions
| diff --git a/debug_toolbar/panels/templates/panel.py b/debug_toolbar/panels/templates/panel.py index df39804..74f28b0 100644 --- a/debug_toolbar/panels/templates/panel.py +++ b/debug_toolbar/panels/templates/panel.py @@ -81,12 +81,8 @@ class TemplatesPanel(Panel):      def __init__(self, *args, **kwargs):          super(TemplatesPanel, self).__init__(*args, **kwargs)          self.templates = [] -        template_rendered.connect(self._store_template_info)      def _store_template_info(self, sender, **kwargs): -        if not self.enabled: -            return -          template, context = kwargs['template'], kwargs['context']          # Skip templates that we are generating through the debug toolbar. @@ -157,6 +153,12 @@ class TemplatesPanel(Panel):              url(r'^template_source/$', 'template_source', name='template_source'),          ) +    def enable_instrumentation(self): +        template_rendered.connect(self._store_template_info) + +    def disable_instrumentation(self): +        template_rendered.disconnect(self._store_template_info) +      def process_response(self, request, response):          template_context = []          for template_data in self.templates: | 
