Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Python 2.5 compatibility, fixes #261 #342

Merged
merged 1 commit into from

2 participants

@davidwtbuxton

Tested with Python 2.5.6 and Django 1.4.3.

@jezdez jezdez merged commit fb412f7 into django-debug-toolbar:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 11, 2012
  1. @davidwtbuxton
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 2 deletions.
  1. +8 −2 debug_toolbar/utils/__init__.py
  2. +1 −0  tests/tests.py
View
10 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'<span class="path">{0}/</span><span class="file">{1}</span> in <span class="func">{3}</span>(<span class="lineno">{2}</span>)\n <span class="code">{4}</span>'.format(*params))
- except IndexError:
+ stacktrace.append(u'<span class="path">%(0)s/</span>'
+ u'<span class="file">%(1)s</span>'
+ u' in <span class="func">%(3)s</span>'
+ u'(<span class="lineno">%(2)s</span>)\n'
+ u' <span class="code">%(4)s</span>'
+ % 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))
View
1  tests/tests.py
@@ -1,3 +1,4 @@
+from __future__ import with_statement
import thread
from django.conf import settings
Something went wrong with that request. Please try again.