Method: flask.app.Flask.process_response
Calls: 409, Exceptions: 4, Paths: 7Back
Path 1: 331 calls (0.81)
Response (331)
Response (331)
1def process_response(self, response: Response) -> Response:
2 """Can be overridden in order to modify the response object
3 before it's sent to the WSGI server. By default this will
4 call all the :meth:`after_request` decorated functions.
5
6 .. versionchanged:: 0.5
7 As of Flask 0.5 the functions registered for after request
8 execution are called in reverse order of registration.
9
10 :param response: a :attr:`response_class` object.
11 :return: a new response object or the same, has to be an
12 instance of :attr:`response_class`.
13 """
14 ctx = request_ctx._get_current_object() # type: ignore[attr-defined]
15
16 for func in ctx._after_request_functions:
17 response = self.ensure_sync(func)(response)
18
19 for name in chain(request.blueprints, (None,)):
20 if name in self.after_request_funcs:
21 for func in reversed(self.after_request_funcs[name]):
22 response = self.ensure_sync(func)(response)
23
24 if not self.session_interface.is_null_session(ctx.session):
25 self.session_interface.save_session(self, ctx.session, response)
26
27 return response
Path 2: 61 calls (0.15)
Response (61)
Response (61)
1def process_response(self, response: Response) -> Response:
2 """Can be overridden in order to modify the response object
3 before it's sent to the WSGI server. By default this will
4 call all the :meth:`after_request` decorated functions.
5
6 .. versionchanged:: 0.5
7 As of Flask 0.5 the functions registered for after request
8 execution are called in reverse order of registration.
9
10 :param response: a :attr:`response_class` object.
11 :return: a new response object or the same, has to be an
12 instance of :attr:`response_class`.
13 """
14 ctx = request_ctx._get_current_object() # type: ignore[attr-defined]
15
16 for func in ctx._after_request_functions:
17 response = self.ensure_sync(func)(response)
18
19 for name in chain(request.blueprints, (None,)):
20 if name in self.after_request_funcs:
21 for func in reversed(self.after_request_funcs[name]):
22 response = self.ensure_sync(func)(response)
23
24 if not self.session_interface.is_null_session(ctx.session):
25 self.session_interface.save_session(self, ctx.session, response)
26
27 return response
Path 3: 9 calls (0.02)
Response (9)
Response (9)
1def process_response(self, response: Response) -> Response:
2 """Can be overridden in order to modify the response object
3 before it's sent to the WSGI server. By default this will
4 call all the :meth:`after_request` decorated functions.
5
6 .. versionchanged:: 0.5
7 As of Flask 0.5 the functions registered for after request
8 execution are called in reverse order of registration.
9
10 :param response: a :attr:`response_class` object.
11 :return: a new response object or the same, has to be an
12 instance of :attr:`response_class`.
13 """
14 ctx = request_ctx._get_current_object() # type: ignore[attr-defined]
15
16 for func in ctx._after_request_functions:
17 response = self.ensure_sync(func)(response)
18
19 for name in chain(request.blueprints, (None,)):
20 if name in self.after_request_funcs:
21 for func in reversed(self.after_request_funcs[name]):
22 response = self.ensure_sync(func)(response)
23
24 if not self.session_interface.is_null_session(ctx.session):
25 self.session_interface.save_session(self, ctx.session, response)
26
27 return response
Path 4: 3 calls (0.01)
Response (3)
Response (3)
1def process_response(self, response: Response) -> Response:
2 """Can be overridden in order to modify the response object
3 before it's sent to the WSGI server. By default this will
4 call all the :meth:`after_request` decorated functions.
5
6 .. versionchanged:: 0.5
7 As of Flask 0.5 the functions registered for after request
8 execution are called in reverse order of registration.
9
10 :param response: a :attr:`response_class` object.
11 :return: a new response object or the same, has to be an
12 instance of :attr:`response_class`.
13 """
14 ctx = request_ctx._get_current_object() # type: ignore[attr-defined]
15
16 for func in ctx._after_request_functions:
17 response = self.ensure_sync(func)(response)
18
19 for name in chain(request.blueprints, (None,)):
20 if name in self.after_request_funcs:
21 for func in reversed(self.after_request_funcs[name]):
22 response = self.ensure_sync(func)(response)
23
24 if not self.session_interface.is_null_session(ctx.session):
25 self.session_interface.save_session(self, ctx.session, response)
26
27 return response
Path 5: 2 calls (0.0)
Response (2)
ValueError (1) NotImplementedError (1)
1def process_response(self, response: Response) -> Response:
2 """Can be overridden in order to modify the response object
3 before it's sent to the WSGI server. By default this will
4 call all the :meth:`after_request` decorated functions.
5
6 .. versionchanged:: 0.5
7 As of Flask 0.5 the functions registered for after request
8 execution are called in reverse order of registration.
9
10 :param response: a :attr:`response_class` object.
11 :return: a new response object or the same, has to be an
12 instance of :attr:`response_class`.
13 """
14 ctx = request_ctx._get_current_object() # type: ignore[attr-defined]
15
16 for func in ctx._after_request_functions:
17 response = self.ensure_sync(func)(response)
18
19 for name in chain(request.blueprints, (None,)):
20 if name in self.after_request_funcs:
21 for func in reversed(self.after_request_funcs[name]):
22 response = self.ensure_sync(func)(response)
23
24 if not self.session_interface.is_null_session(ctx.session):
25 self.session_interface.save_session(self, ctx.session, response)
26
27 return response
Path 6: 2 calls (0.0)
Response (2)
ZeroDivisionError (2)
1def process_response(self, response: Response) -> Response:
2 """Can be overridden in order to modify the response object
3 before it's sent to the WSGI server. By default this will
4 call all the :meth:`after_request` decorated functions.
5
6 .. versionchanged:: 0.5
7 As of Flask 0.5 the functions registered for after request
8 execution are called in reverse order of registration.
9
10 :param response: a :attr:`response_class` object.
11 :return: a new response object or the same, has to be an
12 instance of :attr:`response_class`.
13 """
14 ctx = request_ctx._get_current_object() # type: ignore[attr-defined]
15
16 for func in ctx._after_request_functions:
17 response = self.ensure_sync(func)(response)
18
19 for name in chain(request.blueprints, (None,)):
20 if name in self.after_request_funcs:
21 for func in reversed(self.after_request_funcs[name]):
22 response = self.ensure_sync(func)(response)
23
24 if not self.session_interface.is_null_session(ctx.session):
25 self.session_interface.save_session(self, ctx.session, response)
26
27 return response
Path 7: 1 calls (0.0)
Response (1)
Response (1)
1def process_response(self, response: Response) -> Response:
2 """Can be overridden in order to modify the response object
3 before it's sent to the WSGI server. By default this will
4 call all the :meth:`after_request` decorated functions.
5
6 .. versionchanged:: 0.5
7 As of Flask 0.5 the functions registered for after request
8 execution are called in reverse order of registration.
9
10 :param response: a :attr:`response_class` object.
11 :return: a new response object or the same, has to be an
12 instance of :attr:`response_class`.
13 """
14 ctx = request_ctx._get_current_object() # type: ignore[attr-defined]
15
16 for func in ctx._after_request_functions:
17 response = self.ensure_sync(func)(response)
18
19 for name in chain(request.blueprints, (None,)):
20 if name in self.after_request_funcs:
21 for func in reversed(self.after_request_funcs[name]):
22 response = self.ensure_sync(func)(response)
23
24 if not self.session_interface.is_null_session(ctx.session):
25 self.session_interface.save_session(self, ctx.session, response)
26
27 return response