From fdd25705a4b0443694cf6da9e0f846e991c44493 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Thu, 14 Jul 2011 11:06:01 -0700 Subject: Dont modify the original context dictionary (fixes #184) --- debug_toolbar/panels/template.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'debug_toolbar') 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] = '<>' + temp_layer[key] = '<>' # 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] = '<>' + temp_layer[key] = '<>' # Replace LANGUAGES, which is available in i18n context processor elif key == 'LANGUAGES' and isinstance(value, tuple): - context_layer[key] = '<>' + temp_layer[key] = '<>' + 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 -- cgit v1.2.3