From a7c8e2ab8186a01009a163e4c714ebec95e3cc4e Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Tue, 28 Feb 2012 00:08:07 -0600 Subject: Provide request to Middleware.process_response() It appears that no middleware has taken advantage of the builtin process_response(response) convention, because a reference to the original request is typically necessary to build an appropriate response. Change-Id: If032261974eb1d756abdbd5b18892091978e2a07 --- keystone/common/wsgi.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'keystone/common') diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py index c75339f5..6279d4cc 100644 --- a/keystone/common/wsgi.py +++ b/keystone/common/wsgi.py @@ -260,7 +260,7 @@ class Middleware(Application): def __init__(self, application): self.application = application - def process_request(self, req): + def process_request(self, request): """Called on each request. If this returns None, the next application down the stack will be @@ -270,17 +270,17 @@ class Middleware(Application): """ return None - def process_response(self, response): - """Do whatever you'd like to the response.""" + def process_response(self, request, response): + """Do whatever you'd like to the response, based on the request.""" return response @webob.dec.wsgify(RequestClass=Request) - def __call__(self, req): - response = self.process_request(req) + def __call__(self, request): + response = self.process_request(request) if response: return response - response = req.get_response(self.application) - return self.process_response(response) + response = request.get_response(self.application) + return self.process_response(request, response) class Debug(Middleware): -- cgit