Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sent got_request_exception signal before handle_uncaught_exception

In some cases (notably Python 3), when handle_uncaught_exception was
itself raising an exception, the got_request_exception was storing
the latter exception instead of the original exception.
  • Loading branch information...
commit 64531df5df1fdb93af4eebaa7994716d6cd5b15f 1 parent 31ae103
@claudep claudep authored
Showing with 5 additions and 9 deletions.
  1. +5 −9 django/core/handlers/base.py
View
14 django/core/handlers/base.py
@@ -152,10 +152,8 @@ def get_response(self, request):
callback, param_dict = resolver.resolve404()
response = callback(request, **param_dict)
except:
- try:
- response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
- finally:
- signals.got_request_exception.send(sender=self.__class__, request=request)
+ signals.got_request_exception.send(sender=self.__class__, request=request)
+ response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
except exceptions.PermissionDenied:
logger.warning(
'Forbidden (Permission denied): %s', request.path,
@@ -167,12 +165,10 @@ def get_response(self, request):
callback, param_dict = resolver.resolve403()
response = callback(request, **param_dict)
except:
- try:
- response = self.handle_uncaught_exception(request,
- resolver, sys.exc_info())
- finally:
- signals.got_request_exception.send(
+ signals.got_request_exception.send(
sender=self.__class__, request=request)
+ response = self.handle_uncaught_exception(request,
+ resolver, sys.exc_info())
except SystemExit:
# Allow sys.exit() to actually exit. See tickets #1023 and #4701
raise
Please sign in to comment.
Something went wrong with that request. Please try again.