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

Function stream_template_string

src/flask/templating.py:208–220  ·  view source on GitHub ↗

Render a template from the given source string with the given context as a stream. This returns an iterator of strings, which can be used as a streaming response from a view. :param source: The source code of the template to render. :param context: The variables to make available in

(source: str, **context: t.Any)

Source from the content-addressed store, hash-verified

206
207
208def stream_template_string(source: str, **context: t.Any) -> t.Iterator[str]:
209 """Render a template from the given source string with the given
210 context as a stream. This returns an iterator of strings, which can
211 be used as a streaming response from a view.
212
213 :param source: The source code of the template to render.
214 :param context: The variables to make available in the template.
215
216 .. versionadded:: 2.2
217 """
218 app = current_app._get_current_object() # type: ignore[attr-defined]
219 template = app.jinja_env.from_string(source)
220 return _stream(app, template, context)

Callers

nothing calls this directly

Calls 1

_streamFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…