Ticket #1237: wsgi.py.diff

File wsgi.py.diff, 906 bytes (added by junzhang.jn@…, 19 years ago)
  • wsgi.py

     
    149149        # settings weren't available.
    150150        if self._request_middleware is None:
    151151            self.load_middleware()
    152 
     152       
    153153        try:
    154154            request = WSGIRequest(environ)
    155155            response = self.get_response(request.path, request)
     156
     157            # Apply response middleware
     158            for middleware_method in self._response_middleware:
     159                response = middleware_method(request, response)
    156160        finally:
    157161            db.db.close()
    158162
    159         # Apply response middleware
    160         for middleware_method in self._response_middleware:
    161             response = middleware_method(request, response)
    162 
    163163        try:
    164164            status_text = STATUS_CODE_TEXT[response.status_code]
    165165        except KeyError:
Back to Top