Code

Ticket #7471: patch-7471-no-tests.diff

File patch-7471-no-tests.diff, 1.6 KB (added by leahculver, 6 years ago)

return handle_uncaught_exception for errors with the 404 handler

Line 
1Index: django/core/handlers/base.py
2===================================================================
3--- django/core/handlers/base.py        (revision 7955)
4+++ django/core/handlers/base.py        (working copy)
5@@ -107,8 +107,11 @@
6                 from django.views import debug
7                 return debug.technical_404_response(request, e)
8             else:
9-                callback, param_dict = resolver.resolve404()
10-                return callback(request, **param_dict)
11+                try:
12+                    callback, param_dict = resolver.resolve404()
13+                    return callback(request, **param_dict)
14+                except:
15+                    return self.handle_uncaught_exception(request, resolver, sys.exc_info())
16         except exceptions.PermissionDenied:
17             return http.HttpResponseForbidden('<h1>Permission denied</h1>')
18         except SystemExit:
19@@ -118,9 +121,6 @@
20             # Get the exception info now, in case another exception is thrown later.
21             exc_info = sys.exc_info()
22             receivers = dispatcher.send(signal=signals.got_request_exception, request=request)
23-
24-            if settings.DEBUG_PROPAGATE_EXCEPTIONS:
25-                raise
26             return self.handle_uncaught_exception(request, resolver, exc_info)
27 
28     def handle_uncaught_exception(self, request, resolver, exc_info):
29@@ -135,6 +135,9 @@
30         """
31         from django.conf import settings
32         from django.core.mail import mail_admins
33+       
34+        if settings.DEBUG_PROPAGATE_EXCEPTIONS:
35+            raise
36 
37         if settings.DEBUG:
38             from django.views import debug