@@ -0,0 +1,1720 @@
+# Copyright 2011 OpenStack Foundation.%0A# All Rights Reserved.%0A#%0A#    Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A#    not use this file except in compliance with the License. You may obtain%0A#    a copy of the License at%0A#%0A#         http://www.apache.org/licenses/LICENSE-2.0%0A#%0A#    Unless required by applicable law or agreed to in writing, software%0A#    distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A#    License for the specific language governing permissions and limitations%0A#    under the License.%0A%22%22%22Base class(es) for WSGI Middleware.%22%22%22%0A%0Afrom webob import dec%0A%0A%0Aclass Middleware(object):%0A    %22%22%22Base WSGI middleware wrapper.%0A%0A    These classes require an application to be initialized that will be called%0A    next.  By default the middleware will simply call its wrapped app, or you%0A    can override __call__ to customize its behavior.%0A    %22%22%22%0A%0A    def __init__(self, application):%0A        self.application = application%0A%0A    def process_request(self, req):%0A        %22%22%22Called on each request.%0A%0A        If this returns None, the next application down the stack will be%0A        executed. If it returns a response then that response will be returned%0A        and execution will stop here.%0A        %22%22%22%0A        return None%0A%0A    def process_response(self, response):%0A        %22%22%22Do whatever you'd like to the response.%22%22%22%0A        return response%0A%0A    @dec.wsgify%0A    def __call__(self, req):%0A        response = self.process_request(req)%0A        if response:%0A            return response%0A        response = req.get_response(self.application)%0A        return self.process_response(response)%0A

Add Base Middleware class.