def process(self, app, middleware):
for middleware_string in middleware:
middleware = import_string(middleware_string)
response = middleware()
if hasattr(response, 'preprocess_request'):
before_request = response.preprocess_request
app.before_request(before_request)
if hasattr(response, 'process_response'):
after_request = response.process_response
app.after_request(after_request)
评论列表
文章目录