Fixed #3187 -- Django will now look for the root URLconf as an attribute of the request object, if available. This lets middleware override the urlconf as needed. Thanks, Fredrik Lundh.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4237 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2006-12-26 14:40:33 +00:00
parent 86870e7587
commit a5d3e0c3ef
1 changed files with 4 additions and 1 deletions

View File

@ -60,7 +60,10 @@ class BaseHandler(object):
if response: if response:
return response return response
resolver = urlresolvers.RegexURLResolver(r'^/', settings.ROOT_URLCONF) # Get urlconf from request object, if available. Otherwise use default.
urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF)
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
try: try:
callback, callback_args, callback_kwargs = resolver.resolve(request.path) callback, callback_args, callback_kwargs = resolver.resolve(request.path)