def __call__(self, environ, start_response):
request = Request(environ)
- # pass the request through our meddleware classes
- for m in self.meddleware:
- response = m.process_request(request)
- if response is not None:
- return response(environ, start_response)
-
## Routing / controller loading stuff
path_info = request.path_info
route_match = self.routing.match(path_info)
return render_404(request)(environ, start_response)
controller = common.import_component(route_match['controller'])
+
+ # pass the request through our meddleware classes
+ for m in self.meddleware:
+ response = m.process_request(request, controller)
+ if response is not None:
+ return response(environ, start_response)
+
request.start_response = start_response
# get the response from the controller
def __init__(self, mg_app):
self.app = mg_app
- def process_request(self, request):
+ def process_request(self, request, controller):
pass
def process_response(self, request, response):
CSRF_KEYLEN = 64
SAFE_HTTP_METHODS = ("GET", "HEAD", "OPTIONS", "TRACE")
- def process_request(self, request):
+ def process_request(self, request, controller):
"""For non-safe requests, confirm that the tokens are present
and match.
"""
class NoOpMeddleware(BaseMeddleware):
- def process_request(self, request):
+
+ def process_request(self, request, controller):
pass
def process_response(self, request, response):