Code

Ticket #894: response-middleware-error.patch

File response-middleware-error.patch, 1.6 KB (added by sune.kirkeby@…, 8 years ago)
  • wsgi.py

     
    155155        finally: 
    156156            db.db.close() 
    157157 
    158         # Apply response middleware 
    159         for middleware_method in self._response_middleware: 
    160             response = middleware_method(request, response) 
    161  
    162158        try: 
    163159            status_text = STATUS_CODE_TEXT[response.status_code] 
    164160        except KeyError: 
  • base.py

     
    8383            if response is None: 
    8484                raise ValueError, "The view %s.%s didn't return an HttpResponse object." % (callback.__module__, callback.func_name) 
    8585 
     86            # Apply response middleware 
     87            for middleware_method in self._response_middleware: 
     88                response = middleware_method(request, response) 
     89 
    8690            return response 
    8791        except exceptions.Http404, e: 
    8892            if DEBUG: 
  • modpython.py

     
    140140        finally: 
    141141            db.db.close() 
    142142 
    143         # Apply response middleware 
    144         for middleware_method in self._response_middleware: 
    145             response = middleware_method(request, response) 
    146  
    147143        # Convert our custom HttpResponse object back into the mod_python req. 
    148144        populate_apache_request(response, req) 
    149145        return 0 # mod_python.apache.OK