Commits

uber...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed 65e363a

0.91-bugfixes: fix a problem on mod_python that could result in stale DB connections

  • Participants
  • Parent commits 2092372
  • Branches 0.91-bugfixes

Comments (0)

Files changed (1)

File django/core/handlers/modpython.py

         try:
             request = ModPythonRequest(req)
             response = self.get_response(req.uri, request)
+            # Apply response middleware
+            for middleware_method in self._response_middleware:
+                response = middleware_method(request, response)
         finally:
             db.db.close()
 
-        # Apply response middleware
-        for middleware_method in self._response_middleware:
-            response = middleware_method(request, response)
-
         # Convert our custom HttpResponse object back into the mod_python req.
         populate_apache_request(response, req)
         return 0 # mod_python.apache.OK