Method: flask.scaffold.Scaffold.url_value_preprocessor
Calls: 2, Exceptions: 0, Paths: 1Back
Path 1: 2 calls (1.0)
test_url_processors.
test_url_processors.
1@setupmethod
2 def url_value_preprocessor(
3 self,
4 f: T_url_value_preprocessor,
5 ) -> T_url_value_preprocessor:
6 """Register a URL value preprocessor function for all view
7 functions in the application. These functions will be called before the
8 :meth:`before_request` functions.
9
10 The function can modify the values captured from the matched url before
11 they are passed to the view. For example, this can be used to pop a
12 common language code value and place it in ``g`` rather than pass it to
13 every view.
14
15 The function is passed the endpoint name and values dict. The return
16 value is ignored.
17
18 This is available on both app and blueprint objects. When used on an app, this
19 is called for every request. When used on a blueprint, this is called for
20 requests that the blueprint handles. To register with a blueprint and affect
21 every request, use :meth:`.Blueprint.app_url_value_preprocessor`.
22 """
23 self.url_value_preprocessors[None].append(f)
24 return f