diff options
Diffstat (limited to 'debug_toolbar/utils')
| -rw-r--r-- | debug_toolbar/utils/__init__.py | 6 | ||||
| -rw-r--r-- | debug_toolbar/utils/sql.py | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/debug_toolbar/utils/__init__.py b/debug_toolbar/utils/__init__.py index 297c901..75f3024 100644 --- a/debug_toolbar/utils/__init__.py +++ b/debug_toolbar/utils/__init__.py @@ -7,6 +7,7 @@ import sys from django.conf import settings from django.views.debug import linebreak_iter +from django.utils.encoding import force_text from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils import six @@ -39,10 +40,7 @@ def tidy_stacktrace(stack): continue if socketserver_path in s_path: continue - if not text: - text = '' - else: - text = (''.join(text)).strip() + text = (''.join(force_text(t) for t in text)).strip() if text else '' trace.append((path, line_no, func_name, text)) return trace diff --git a/debug_toolbar/utils/sql.py b/debug_toolbar/utils/sql.py index 4e0d70d..2810699 100644 --- a/debug_toolbar/utils/sql.py +++ b/debug_toolbar/utils/sql.py @@ -29,5 +29,5 @@ def reformat_sql(sql): def swap_fields(sql): - return re.sub('SELECT</strong> (.*?) <strong>FROM', 'SELECT</strong> <a class="djDebugUncollapsed djDebugToggle" href="#">•••</a> ' + + return re.sub('SELECT</strong> (.*?) <strong>FROM', 'SELECT</strong> <a class="djDebugUncollapsed djDebugToggle" href="#">•••</a> ' + '<a class="djDebugCollapsed djDebugToggle" href="#">\g<1></a> <strong>FROM', sql) |
