mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #13090 -- Corrected handling of errors in middleware when DEBUG=False. Thanks to EroSennin for the report, and Ivan Sagalaev for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12773 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -70,10 +70,10 @@ class BaseHandler(object):
|
||||
|
||||
try:
|
||||
try:
|
||||
# Reset the urlconf for this thread.
|
||||
urlresolvers.set_urlconf(None)
|
||||
# Obtain a default resolver. It's needed early for handling 404's.
|
||||
resolver = urlresolvers.RegexURLResolver(r'^/', None)
|
||||
# Setup default url resolver for this thread.
|
||||
urlconf = settings.ROOT_URLCONF
|
||||
urlresolvers.set_urlconf(urlconf)
|
||||
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
|
||||
|
||||
# Apply request middleware
|
||||
for middleware_method in self._request_middleware:
|
||||
@@ -81,12 +81,11 @@ class BaseHandler(object):
|
||||
if response:
|
||||
return response
|
||||
|
||||
# Get urlconf from request object, if available. Otherwise use default.
|
||||
urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF)
|
||||
# Set the urlconf for this thread to the one specified above.
|
||||
urlresolvers.set_urlconf(urlconf)
|
||||
# Reset the resolver with a possibly new urlconf
|
||||
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
|
||||
if hasattr(request, "urlconf"):
|
||||
# Reset url resolver with a custom urlconf.
|
||||
urlconf = request.urlconf
|
||||
urlresolvers.set_urlconf(urlconf)
|
||||
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
|
||||
|
||||
callback, callback_args, callback_kwargs = resolver.resolve(
|
||||
request.path_info)
|
||||
|
||||
Reference in New Issue
Block a user