MCPcopy
hub / github.com/pallets/flask / _stream

Function _stream

src/flask/templating.py:166–186  ·  view source on GitHub ↗
(
    app: Flask, template: Template, context: dict[str, t.Any]
)

Source from the content-addressed store, hash-verified

164
165
166def _stream(
167 app: Flask, template: Template, context: dict[str, t.Any]
168) -> t.Iterator[str]:
169 app.update_template_context(context)
170 before_render_template.send(
171 app, _async_wrapper=app.ensure_sync, template=template, context=context
172 )
173
174 def generate() -> t.Iterator[str]:
175 yield from template.generate(context)
176 template_rendered.send(
177 app, _async_wrapper=app.ensure_sync, template=template, context=context
178 )
179
180 rv = generate()
181
182 # If a request context is active, keep it while generating.
183 if request:
184 rv = stream_with_context(rv)
185
186 return rv
187
188
189def stream_template(

Callers 2

stream_templateFunction · 0.85
stream_template_stringFunction · 0.85

Calls 3

generateFunction · 0.85
stream_with_contextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…