aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/panels
diff options
context:
space:
mode:
authorAlex Gaynor2009-08-11 13:33:03 -0500
committerAlex Gaynor2009-08-11 13:33:03 -0500
commit89a0b38316e1822bf22a4f013a6bb12f9db585b8 (patch)
treee869b25e9ca66c29a8c75179e7a1ed4e75a8cabf /debug_toolbar/panels
parent90681f01b4ba3261fb1a44559dc0ada539249719 (diff)
downloaddjango-debug-toolbar-89a0b38316e1822bf22a4f013a6bb12f9db585b8.tar.bz2
allow for handling the pathological case of an insanely large template context
Diffstat (limited to 'debug_toolbar/panels')
-rw-r--r--debug_toolbar/panels/template.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py
index ad6dd04..e99b9c5 100644
--- a/debug_toolbar/panels/template.py
+++ b/debug_toolbar/panels/template.py
@@ -73,15 +73,16 @@ class TemplateDebugPanel(DebugPanel):
t.origin_name = 'No origin'
info['template'] = t
# Clean up context for better readability
- c = d.get('context', None)
-
- d_list = []
- for _d in c.dicts:
- try:
- d_list.append(pformat(d))
- except UnicodeEncodeError:
- pass
- info['context'] = '\n'.join(d_list)
+ if getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {}).get('SHOW_TEMPLATE_CONTEXT', True):
+ c = d.get('context', None)
+
+ d_list = []
+ for _d in c.dicts:
+ try:
+ d_list.append(pformat(d))
+ except UnicodeEncodeError:
+ pass
+ info['context'] = '\n'.join(d_list)
template_context.append(info)
context = {
'templates': template_context,