diff options
| -rw-r--r-- | debug_toolbar/panels/signals.py | 8 | ||||
| -rw-r--r-- | debug_toolbar/panels/template.py | 9 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/redirect.html | 2 |
3 files changed, 16 insertions, 3 deletions
diff --git a/debug_toolbar/panels/signals.py b/debug_toolbar/panels/signals.py index 0a75282..7fe382e 100644 --- a/debug_toolbar/panels/signals.py +++ b/debug_toolbar/panels/signals.py @@ -3,12 +3,16 @@ import sys from django.conf import settings from django.core.signals import request_started, request_finished, \ got_request_exception -from django.db.backends.signals import connection_created from django.db.models.signals import class_prepared, pre_init, post_init, \ pre_save, post_save, pre_delete, post_delete, post_syncdb from django.dispatch.dispatcher import WEAKREF_TYPES from django.template.loader import render_to_string +try: + from django.db.backends.signals import connection_created +except ImportError: + connection_created = None + from debug_toolbar.panels import DebugPanel class SignalDebugPanel(DebugPanel): @@ -56,6 +60,8 @@ class SignalDebugPanel(DebugPanel): keys.sort() for name in keys: signal = self.signals[name] + if signal is None: + continue receivers = [] for (receiverkey, r_senderkey), receiver in signal.receivers: if isinstance(receiver, WEAKREF_TYPES): diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py index 7dc7b06..b548287 100644 --- a/debug_toolbar/panels/template.py +++ b/debug_toolbar/panels/template.py @@ -72,7 +72,14 @@ class TemplateDebugPanel(DebugPanel): info['template'] = t # Clean up context for better readability c = d.get('context', None) - info['context'] = '\n'.join([pformat(_d) for _d in c.dicts]) + + d_list = [] + for _d in c.dicts: + try: + d_list.append(pformat(d)) + except UnicodeEncodeError: + pass + info['context'] = '\n'.join(d_list) template_context.append(info) context = { 'templates': template_context, diff --git a/debug_toolbar/templates/debug_toolbar/redirect.html b/debug_toolbar/templates/debug_toolbar/redirect.html index afdccc4..1f5c84b 100644 --- a/debug_toolbar/templates/debug_toolbar/redirect.html +++ b/debug_toolbar/templates/debug_toolbar/redirect.html @@ -3,7 +3,7 @@ </head> <body> <h1>HttpResponseRedirect</h1> -<p>Location: <a href="{{ redirect_to }}">{{ redirect_to }}</a></p> +<p>Location: <a href="{{ redirect_to|urlencode }}">{{ redirect_to }}</a></p> <p class="notice"> The Django Debug Toolbar has intercepted a redirect to the above URL for debug viewing purposes. You can click the above link to continue with the |
