diff options
| author | Jannis Leidel | 2013-03-02 05:12:52 -0800 |
|---|---|---|
| committer | Jannis Leidel | 2013-03-02 05:12:52 -0800 |
| commit | fb412f7f0079f616256d3de4a96c3da879c00c56 (patch) | |
| tree | 5aea49a24a8690b68145d4096dcbcc0af230881b | |
| parent | 0844c8b24527486d43f8ab18241ce0b7f900129b (diff) | |
| parent | 3013b5a6e4c682004207e944ebea172a39e52e8c (diff) | |
| download | django-debug-toolbar-fb412f7f0079f616256d3de4a96c3da879c00c56.tar.bz2 | |
Merge pull request #342 from davidwtbuxton/master
Python 2.5 compatibility, fixes #261
| -rw-r--r-- | debug_toolbar/utils/__init__.py | 10 | ||||
| -rw-r--r-- | tests/tests.py | 1 |
2 files changed, 9 insertions, 2 deletions
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'<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)) diff --git a/tests/tests.py b/tests/tests.py index a3618bf..f76f1ab 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -1,3 +1,4 @@ +from __future__ import with_statement import thread from django.conf import settings |
