Method: flask.templating._stream
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
Flask (1)
Template (1)
{'config': 42} (1)
stream_with_context.
1def _stream(
2 app: Flask, template: Template, context: dict[str, t.Any]
3) -> t.Iterator[str]:
4 app.update_template_context(context)
5 before_render_template.send(
6 app, _async_wrapper=app.ensure_sync, template=template, context=context
7 )
8
9 def generate() -> t.Iterator[str]:
10 yield from template.generate(context)
11 template_rendered.send(
12 app, _async_wrapper=app.ensure_sync, template=template, context=context
13 )
14
15 rv = generate()
16
17 # If a request context is active, keep it while generating.
18 if request:
19 rv = stream_with_context(rv)
20
21 return rv