From 3013b5a6e4c682004207e944ebea172a39e52e8c Mon Sep 17 00:00:00 2001
From: David Buxton
Date: Tue, 11 Dec 2012 11:36:25 +0000
Subject: Python 2.5 compatibility #261
---
debug_toolbar/utils/__init__.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
(limited to 'debug_toolbar/utils')
diff --git a/debug_toolbar/utils/__init__.py b/debug_toolbar/utils/__init__.py
index bfb485c..2d2ff10 100644
--- a/debug_toolbar/utils/__init__.py
+++ b/debug_toolbar/utils/__init__.py
@@ -56,9 +56,15 @@ def render_stacktrace(trace):
stacktrace = []
for frame in trace:
params = map(escape, frame[0].rsplit(os.path.sep, 1) + list(frame[1:]))
+ params_dict = dict((unicode(idx), v) for idx, v in enumerate(params))
try:
- stacktrace.append(u'{0}/{1} in {3}({2})\n {4}'.format(*params))
- except IndexError:
+ stacktrace.append(u'%(0)s/'
+ u'%(1)s'
+ u' in %(3)s'
+ u'(%(2)s)\n'
+ u' %(4)s'
+ % params_dict)
+ except KeyError:
# This frame doesn't have the expected format, so skip it and move on to the next one
continue
return mark_safe('\n'.join(stacktrace))
--
cgit v1.2.3