Fixed #7471 -- If the 400 response handler raises an exception, pass control to
the 500 handler (if that then raises an exception, it's just not your day). Patch from Leah Culver. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7988 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
344383284c
commit
795b6a1271
|
@ -107,8 +107,11 @@ class BaseHandler(object):
|
||||||
from django.views import debug
|
from django.views import debug
|
||||||
return debug.technical_404_response(request, e)
|
return debug.technical_404_response(request, e)
|
||||||
else:
|
else:
|
||||||
callback, param_dict = resolver.resolve404()
|
try:
|
||||||
return callback(request, **param_dict)
|
callback, param_dict = resolver.resolve404()
|
||||||
|
return callback(request, **param_dict)
|
||||||
|
except:
|
||||||
|
return self.handle_uncaught_exception(request, resolver, sys.exc_info())
|
||||||
except exceptions.PermissionDenied:
|
except exceptions.PermissionDenied:
|
||||||
return http.HttpResponseForbidden('<h1>Permission denied</h1>')
|
return http.HttpResponseForbidden('<h1>Permission denied</h1>')
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
|
@ -118,9 +121,6 @@ class BaseHandler(object):
|
||||||
# Get the exception info now, in case another exception is thrown later.
|
# Get the exception info now, in case another exception is thrown later.
|
||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
receivers = dispatcher.send(signal=signals.got_request_exception, request=request)
|
receivers = dispatcher.send(signal=signals.got_request_exception, request=request)
|
||||||
|
|
||||||
if settings.DEBUG_PROPAGATE_EXCEPTIONS:
|
|
||||||
raise
|
|
||||||
return self.handle_uncaught_exception(request, resolver, exc_info)
|
return self.handle_uncaught_exception(request, resolver, exc_info)
|
||||||
|
|
||||||
def handle_uncaught_exception(self, request, resolver, exc_info):
|
def handle_uncaught_exception(self, request, resolver, exc_info):
|
||||||
|
@ -136,6 +136,9 @@ class BaseHandler(object):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.mail import mail_admins
|
from django.core.mail import mail_admins
|
||||||
|
|
||||||
|
if settings.DEBUG_PROPAGATE_EXCEPTIONS:
|
||||||
|
raise
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
from django.views import debug
|
from django.views import debug
|
||||||
return debug.technical_500_response(request, *exc_info)
|
return debug.technical_500_response(request, *exc_info)
|
||||||
|
|
Loading…
Reference in New Issue