Commits

uber...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed f1c6269

0.91-bugfixes: Move request middleware into the handler's try/catch block so we can deal with exceptions it throws

  • Participants
  • Parent commits 3d71042
  • Branches 0.91-bugfixes

Comments (0)

Files changed (1)

File django/core/handlers/base.py

         # Reset query list per request.
         db.db.queries = []
 
-        # Apply request middleware
-        for middleware_method in self._request_middleware:
-            response = middleware_method(request)
-            if response:
-                return response
-
         resolver = urlresolvers.RegexURLResolver(r'^/', ROOT_URLCONF)
         try:
+            # Apply request middleware
+            for middleware_method in self._request_middleware:
+                response = middleware_method(request)
+                if response:
+                    return response
+            
             callback, callback_args, callback_kwargs = resolver.resolve(path)
 
             # Apply view middleware