Method: flask.scaffold.Scaffold.context_processor
Calls: 7, Exceptions: 0, Paths: 1Back
Path 1: 7 calls (1.0)
test_context_processing. test_context_processing.
1@setupmethod
2 def context_processor(
3 self,
4 f: T_template_context_processor,
5 ) -> T_template_context_processor:
6 """Registers a template context processor function. These functions run before
7 rendering a template. The keys of the returned dict are added as variables
8 available in the template.
9
10 This is available on both app and blueprint objects. When used on an app, this
11 is called for every rendered template. When used on a blueprint, this is called
12 for templates rendered from the blueprint's views. To register with a blueprint
13 and affect every template, use :meth:`.Blueprint.app_context_processor`.
14 """
15 self.template_context_processors[None].append(f)
16 return f