django/django — pull request #1778 by schacki (2013-10-19 11:28:03+00:00)
Title: Ticket 20752: Error signals are not reliable, especially when dealing with database errors

This is a pull request for ticket https://code.djangoproject.com/ticket/20752

I have changed the core handler in a way such that:

- the initial error is logged as expected, so the root cause of the trouble is visible and not covered by any other exceptions
- all connected handlers are completely executed as expected, so no unexpected side-effects from one handler to the other
- any exceptions from the handlers are logged to the error log, so no errors pass silently, even if therec are multiple.

I have also added unit tests to check that the log entries are created as expected. Since we are dealing with "real" log messages in these test cases, the log messages are more complicated than in the tests for the Django logging. Therefore, I also amended the django.test.utils.patch.logger.

Please check, if the additional log messages for "Request Signal Handler Error" contain the content, that you would expect.