From 8e124b0a129ab351ec6cae30d8358709d4c1430b Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sat, 20 Sep 2008 20:30:45 +0100 Subject: Use pformat for template contexts, which makes it more readable --- debug_toolbar/panels/template.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'debug_toolbar/panels') diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py index bda6630..e08f220 100644 --- a/debug_toolbar/panels/template.py +++ b/debug_toolbar/panels/template.py @@ -5,6 +5,8 @@ from django.template.loader import render_to_string from django.test.signals import template_rendered from debug_toolbar.panels import DebugPanel +from pprint import pformat + # Code taken and adapted from Simon Willison and Django Snippets: # http://www.djangosnippets.org/snippets/766/ @@ -60,7 +62,7 @@ class TemplateDebugPanel(DebugPanel): info['template'] = t # Clean up context for better readability c = d.get('context', None) - info['context'] = '\n'.join([_d.__repr__() for _d in c.dicts]) + info['context'] = '\n'.join([pformat(_d) for _d in c.dicts]) template_context.append(info) context = { 'templates': template_context, -- cgit v1.2.3