Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 795b6a12714d8e2ce43c9316dd9d1af8223bf659 1 parent 3443832
Malcolm Tredinnick authored July 19, 2008

Showing 1 changed file with 8 additions and 5 deletions. Show diff stats Hide diff stats

  1. 13  django/core/handlers/base.py
13  django/core/handlers/base.py
@@ -107,8 +107,11 @@ def get_response(self, request):
107 107
                 from django.views import debug
108 108
                 return debug.technical_404_response(request, e)
109 109
             else:
110  
-                callback, param_dict = resolver.resolve404()
111  
-                return callback(request, **param_dict)
  110
+                try:
  111
+                    callback, param_dict = resolver.resolve404()
  112
+                    return callback(request, **param_dict)
  113
+                except:
  114
+                    return self.handle_uncaught_exception(request, resolver, sys.exc_info())
112 115
         except exceptions.PermissionDenied:
113 116
             return http.HttpResponseForbidden('<h1>Permission denied</h1>')
114 117
         except SystemExit:
@@ -118,9 +121,6 @@ def get_response(self, request):
118 121
             # Get the exception info now, in case another exception is thrown later.
119 122
             exc_info = sys.exc_info()
120 123
             receivers = dispatcher.send(signal=signals.got_request_exception, request=request)
121  
-
122  
-            if settings.DEBUG_PROPAGATE_EXCEPTIONS:
123  
-                raise
124 124
             return self.handle_uncaught_exception(request, resolver, exc_info)
125 125
 
126 126
     def handle_uncaught_exception(self, request, resolver, exc_info):
@@ -136,6 +136,9 @@ def handle_uncaught_exception(self, request, resolver, exc_info):
136 136
         from django.conf import settings
137 137
         from django.core.mail import mail_admins
138 138
 
  139
+        if settings.DEBUG_PROPAGATE_EXCEPTIONS:
  140
+            raise
  141
+
139 142
         if settings.DEBUG:
140 143
             from django.views import debug
141 144
             return debug.technical_500_response(request, *exc_info)

0 notes on commit 795b6a1

Please sign in to comment.
Something went wrong with that request. Please try again.