Skip to content

Commit

Permalink
We actually don't need to copy the debug toolbar urlconf.
Browse files Browse the repository at this point in the history
  • Loading branch information
nyergler committed May 25, 2011
1 parent a66596e commit 4e07206
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions debug_toolbar/middleware.py
Expand Up @@ -76,15 +76,15 @@ def process_request(self, request):
urlconf_name = getattr(request, 'urlconf', settings.ROOT_URLCONF)
if urlconf_name not in self._urlconfs:

import imp, copy
import imp

original_urlconf = __import__(getattr(request, 'urlconf', settings.ROOT_URLCONF), {}, {}, ['*'])
new_urlconf = imp.new_module('urlconf')
new_urlconf.urlpatterns = copy.copy(debug_toolbar.urls.urlpatterns)
new_urlconf.urlpatterns = debug_toolbar.urls.urlpatterns + \
patterns('',
('', include(original_urlconf)),
)

new_urlconf.urlpatterns += patterns('',
('', include(original_urlconf)),
)
if hasattr(original_urlconf, 'handler404'):
new_urlconf.handler404 = original_urlconf.handler404
if hasattr(original_urlconf, 'handler500'):
Expand Down

0 comments on commit 4e07206

Please sign in to comment.