diff options
| author | bkonkle | 2011-09-09 10:22:19 -0700 |
|---|---|---|
| committer | bkonkle | 2011-09-09 10:22:19 -0700 |
| commit | 7a24088d0d4316e113387d229ed0491e31226348 (patch) | |
| tree | 19cb49c31c3452615acf73fafbc60c14cae6ed16 | |
| parent | abb9b15c93e19c861f41a3dfd05e09b54bd0ff7f (diff) | |
| download | django-debug-toolbar-7a24088d0d4316e113387d229ed0491e31226348.tar.bz2 | |
If a stacktrace frame is not in the expected format, skip over it
| -rw-r--r-- | debug_toolbar/panels/sql.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py index 841aaac..9687a5c 100644 --- a/debug_toolbar/panels/sql.py +++ b/debug_toolbar/panels/sql.py @@ -190,11 +190,15 @@ class SQLDebugPanel(DebugPanel): query['start_offset'] = width_ratio_tally query['end_offset'] = query['width_ratio'] + query['start_offset'] width_ratio_tally += query['width_ratio'] - + stacktrace = [] for frame in query['stacktrace']: params = map(escape, frame[0].rsplit('/', 1) + list(frame[1:])) - 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)) + 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: + # This frame doesn't have the expected format, so skip it and move on to the next one + continue query['stacktrace'] = mark_safe('\n'.join(stacktrace)) i += 1 |
