Code

Ticket #1237: modpython.py.diff

File modpython.py.diff, 1.0 KB (added by junzhang.jn@…, 8 years ago)
Line 
1Index: modpython.py
2===================================================================
3--- modpython.py        £¨ÐÞ¶©°æ 2044£©
4+++ modpython.py        £¨¹¤×÷¿½±´£©
5@@ -137,15 +137,15 @@
6         try:
7             request = ModPythonRequest(req)
8             response = self.get_response(req.uri, request)
9+
10+            # Apply response middleware
11+            for middleware_method in self._response_middleware:
12+                response = middleware_method(request, response)
13+
14+            # Convert our custom HttpResponse object back into the mod_python req.
15+            populate_apache_request(response, req)
16         finally:
17             db.db.close()
18-
19-        # Apply response middleware
20-        for middleware_method in self._response_middleware:
21-            response = middleware_method(request, response)
22-
23-        # Convert our custom HttpResponse object back into the mod_python req.
24-        populate_apache_request(response, req)
25         return 0 # mod_python.apache.OK
26 
27 def populate_apache_request(http_response, mod_python_req):