aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cramer2011-07-14 11:06:01 -0700
committerDavid Cramer2011-07-14 11:06:01 -0700
commitfdd25705a4b0443694cf6da9e0f846e991c44493 (patch)
treed6376177cbb5fae6cb9e8ed1c8b8c469ea1dfd43
parent424b2c956741177a77411a3724257abdc4a1d50c (diff)
downloaddjango-debug-toolbar-fdd25705a4b0443694cf6da9e0f846e991c44493.tar.bz2
Dont modify the original context dictionary (fixes #184)
-rw-r--r--debug_toolbar/panels/template.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py
index 0715c0a..d620a38 100644
--- a/debug_toolbar/panels/template.py
+++ b/debug_toolbar/panels/template.py
@@ -51,22 +51,25 @@ class TemplateDebugPanel(DebugPanel):
context_list = []
for context_layer in context_data.dicts:
+ temp_layer = {}
if hasattr(context_layer, 'items'):
for key, value in context_layer.items():
# Replace any request elements - they have a large
# unicode representation and the request data is
# already made available from the Request Vars panel.
if isinstance(value, http.HttpRequest):
- context_layer[key] = '<<request>>'
+ temp_layer[key] = '<<request>>'
# Replace the debugging sql_queries element. The SQL
# data is already made available from the SQL panel.
elif key == 'sql_queries' and isinstance(value, list):
- context_layer[key] = '<<sql_queries>>'
+ temp_layer[key] = '<<sql_queries>>'
# Replace LANGUAGES, which is available in i18n context processor
elif key == 'LANGUAGES' and isinstance(value, tuple):
- context_layer[key] = '<<languages>>'
+ temp_layer[key] = '<<languages>>'
+ else:
+ temp_layer[key] = value
try:
- context_list.append(pformat(context_layer))
+ context_list.append(pformat(temp_layer))
except UnicodeEncodeError:
pass
kwargs['context'] = context_list