Created
August 22, 2013 06:24
-
-
Save glasslion/6303816 to your computer and use it in GitHub Desktop.
A patch that make django-debug-toolbar work in Python 2.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py | |
index 18fffdc..a0bfce8 100644 | |
--- a/debug_toolbar/panels/sql.py | |
+++ b/debug_toolbar/panels/sql.py | |
@@ -193,8 +193,14 @@ class SQLDebugPanel(DebugPanel): | |
stacktrace = [] | |
for frame in query['stacktrace']: | |
params = map(escape, frame[0].rsplit('/', 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)) | |
+ 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 IndexError: | |
# This frame doesn't have the expected format, so skip it and move on to the next one | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment