aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug_toolbar/middleware.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py
index 232d887..7f0f4bc 100644
--- a/debug_toolbar/middleware.py
+++ b/debug_toolbar/middleware.py
@@ -67,10 +67,14 @@ class DebugToolbarMiddleware(object):
def process_request(self, request):
if self.show_toolbar(request):
if self.override_url:
- original_urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF)
+ original_urlconf = __import__(getattr(request, 'urlconf', settings.ROOT_URLCONF), {}, {}, ['*'])
debug_toolbar.urls.urlpatterns += patterns('',
('', include(original_urlconf)),
)
+ if hasattr(original_urlconf, 'handler404'):
+ debug_toolbar.urls.handler404 = original_urlconf.handler404
+ if hasattr(original_urlconf, 'handler500'):
+ debug_toolbar.urls.handler500 = original_urlconf.handler500
self.override_url = False
request.urlconf = 'debug_toolbar.urls'