Skip to content

Commit fdd2570

Browse files
committed
Dont modify the original context dictionary (fixes django-commons#184)
1 parent 424b2c9 commit fdd2570

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

debug_toolbar/panels/template.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,25 @@ def _store_template_info(self, sender, **kwargs):
5151

5252
context_list = []
5353
for context_layer in context_data.dicts:
54+
temp_layer = {}
5455
if hasattr(context_layer, 'items'):
5556
for key, value in context_layer.items():
5657
# Replace any request elements - they have a large
5758
# unicode representation and the request data is
5859
# already made available from the Request Vars panel.
5960
if isinstance(value, http.HttpRequest):
60-
context_layer[key] = '<<request>>'
61+
temp_layer[key] = '<<request>>'
6162
# Replace the debugging sql_queries element. The SQL
6263
# data is already made available from the SQL panel.
6364
elif key == 'sql_queries' and isinstance(value, list):
64-
context_layer[key] = '<<sql_queries>>'
65+
temp_layer[key] = '<<sql_queries>>'
6566
# Replace LANGUAGES, which is available in i18n context processor
6667
elif key == 'LANGUAGES' and isinstance(value, tuple):
67-
context_layer[key] = '<<languages>>'
68+
temp_layer[key] = '<<languages>>'
69+
else:
70+
temp_layer[key] = value
6871
try:
69-
context_list.append(pformat(context_layer))
72+
context_list.append(pformat(temp_layer))
7073
except UnicodeEncodeError:
7174
pass
7275
kwargs['context'] = context_list

0 commit comments

Comments
 (0)