Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ensure we honor request.urlconf.

Previously, the debug toolbar would always bolt on URLs from ROOT_URLCONF,
which would break another middleware if it inserts URLs onto request.urlconf.
  • Loading branch information...
commit 405e56268a98dff64e500233094719092a61606b 1 parent 930669f
Rob Hudson authored January 18, 2010

Showing 1 changed file with 4 additions and 3 deletions. Show diff stats Hide diff stats

  1. 7  debug_toolbar/middleware.py
7  debug_toolbar/middleware.py
@@ -33,8 +33,6 @@ class DebugToolbarMiddleware(object):
33 33
     """
34 34
     def __init__(self):
35 35
         self.debug_toolbars = {}
36  
-        self.original_urlconf = settings.ROOT_URLCONF
37  
-        self.original_pattern = patterns('', ('', include(self.original_urlconf)),)
38 36
         self.override_url = True
39 37
 
40 38
         # Set method to use to decide to show toolbar
@@ -59,7 +57,10 @@ def _show_toolbar(self, request):
59 57
     def process_request(self, request):
60 58
         if self.show_toolbar(request):
61 59
             if self.override_url:
62  
-                debug_toolbar.urls.urlpatterns += self.original_pattern
  60
+                original_urlconf = getattr(request, 'urlconf', settings.ROOT_URLCONF)
  61
+                debug_toolbar.urls.urlpatterns += patterns('',
  62
+                    ('', include(original_urlconf)),
  63
+                )
63 64
                 self.override_url = False
64 65
             request.urlconf = 'debug_toolbar.urls'
65 66
 

0 notes on commit 405e562

Please sign in to comment.
Something went wrong with that request. Please try again.