Method: flask.app.Flask.preprocess_request
Calls: 424, Exceptions: 2, Paths: 5Back
Path 1: 402 calls (0.95)
None (402)
1def preprocess_request(self) -> ft.ResponseReturnValue | None:
2 """Called before the request is dispatched. Calls
3 :attr:`url_value_preprocessors` registered with the app and the
4 current blueprint (if any). Then calls :attr:`before_request_funcs`
5 registered with the app and the blueprint.
6
7 If any :meth:`before_request` handler returns a non-None value, the
8 value is handled as if it was the return value from the view, and
9 further request handling is stopped.
10 """
11 names = (None, *reversed(request.blueprints))
12
13 for name in names:
14 if name in self.url_value_preprocessors:
15 for url_func in self.url_value_preprocessors[name]:
16 url_func(request.endpoint, request.view_args)
17
18 for name in names:
19 if name in self.before_request_funcs:
20 for before_func in self.before_request_funcs[name]:
21 rv = self.ensure_sync(before_func)()
22
23 if rv is not None:
24 return rv
25
26 return None
Path 2: 12 calls (0.03)
None (12)
1def preprocess_request(self) -> ft.ResponseReturnValue | None:
2 """Called before the request is dispatched. Calls
3 :attr:`url_value_preprocessors` registered with the app and the
4 current blueprint (if any). Then calls :attr:`before_request_funcs`
5 registered with the app and the blueprint.
6
7 If any :meth:`before_request` handler returns a non-None value, the
8 value is handled as if it was the return value from the view, and
9 further request handling is stopped.
10 """
11 names = (None, *reversed(request.blueprints))
12
13 for name in names:
14 if name in self.url_value_preprocessors:
15 for url_func in self.url_value_preprocessors[name]:
16 url_func(request.endpoint, request.view_args)
17
18 for name in names:
19 if name in self.before_request_funcs:
20 for before_func in self.before_request_funcs[name]:
21 rv = self.ensure_sync(before_func)()
22
23 if rv is not None:
24 return rv
25
26 return None
Path 3: 7 calls (0.02)
None (7)
1def preprocess_request(self) -> ft.ResponseReturnValue | None:
2 """Called before the request is dispatched. Calls
3 :attr:`url_value_preprocessors` registered with the app and the
4 current blueprint (if any). Then calls :attr:`before_request_funcs`
5 registered with the app and the blueprint.
6
7 If any :meth:`before_request` handler returns a non-None value, the
8 value is handled as if it was the return value from the view, and
9 further request handling is stopped.
10 """
11 names = (None, *reversed(request.blueprints))
12
13 for name in names:
14 if name in self.url_value_preprocessors:
15 for url_func in self.url_value_preprocessors[name]:
16 url_func(request.endpoint, request.view_args)
17
18 for name in names:
19 if name in self.before_request_funcs:
20 for before_func in self.before_request_funcs[name]:
21 rv = self.ensure_sync(before_func)()
22
23 if rv is not None:
24 return rv
25
26 return None
Path 4: 2 calls (0.0)
ZeroDivisionError (1) RequestEntityTooLarge (1)
1def preprocess_request(self) -> ft.ResponseReturnValue | None:
2 """Called before the request is dispatched. Calls
3 :attr:`url_value_preprocessors` registered with the app and the
4 current blueprint (if any). Then calls :attr:`before_request_funcs`
5 registered with the app and the blueprint.
6
7 If any :meth:`before_request` handler returns a non-None value, the
8 value is handled as if it was the return value from the view, and
9 further request handling is stopped.
10 """
11 names = (None, *reversed(request.blueprints))
12
13 for name in names:
14 if name in self.url_value_preprocessors:
15 for url_func in self.url_value_preprocessors[name]:
16 url_func(request.endpoint, request.view_args)
17
18 for name in names:
19 if name in self.before_request_funcs:
20 for before_func in self.before_request_funcs[name]:
21 rv = self.ensure_sync(before_func)()
22
23 if rv is not None:
24 return rv
25
26 return None
Path 5: 1 calls (0.0)
'hello' (1)
1def preprocess_request(self) -> ft.ResponseReturnValue | None:
2 """Called before the request is dispatched. Calls
3 :attr:`url_value_preprocessors` registered with the app and the
4 current blueprint (if any). Then calls :attr:`before_request_funcs`
5 registered with the app and the blueprint.
6
7 If any :meth:`before_request` handler returns a non-None value, the
8 value is handled as if it was the return value from the view, and
9 further request handling is stopped.
10 """
11 names = (None, *reversed(request.blueprints))
12
13 for name in names:
14 if name in self.url_value_preprocessors:
15 for url_func in self.url_value_preprocessors[name]:
16 url_func(request.endpoint, request.view_args)
17
18 for name in names:
19 if name in self.before_request_funcs:
20 for before_func in self.before_request_funcs[name]:
21 rv = self.ensure_sync(before_func)()
22
23 if rv is not None:
24 return rv
25
26 return None