Method: flask.blueprints.Blueprint.record_once
Calls: 26, Exceptions: 0, Paths: 1Back
Path 1: 26 calls (1.0)
Blueprint.add_app_template_filter.
1@setupmethod
2 def record_once(self, func: t.Callable) -> None:
3 """Works like :meth:`record` but wraps the function in another
4 function that will ensure the function is only called once. If the
5 blueprint is registered a second time on the application, the
6 function passed is not called.
7 """
8
9 def wrapper(state: BlueprintSetupState) -> None:
10 if state.first_registration:
11 func(state)
12
13 self.record(update_wrapper(wrapper, func))