Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A patch that make django-debug-toolbar work in Python 2.5
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