Render a template from the given source with the *context* as a stream. This returns an iterator of strings, which can be used as a streaming response from a view. Arguments: source: The source code of the template to render. context: The variables to make available in
(source: str, **context: Any)
| 116 | |
| 117 | |
| 118 | async def stream_template_string(source: str, **context: Any) -> AsyncIterator[str]: |
| 119 | """Render a template from the given source with the *context* as a stream. |
| 120 | |
| 121 | This returns an iterator of strings, which can |
| 122 | be used as a streaming response from a view. |
| 123 | |
| 124 | Arguments: |
| 125 | source: The source code of the template to render. |
| 126 | context: The variables to make available in the template. |
| 127 | """ |
| 128 | await current_app.update_template_context(context) |
| 129 | template = current_app.jinja_env.from_string(source) |
| 130 | return await _stream(current_app._get_current_object(), template, context) # type: ignore |
| 131 | |
| 132 | |
| 133 | async def _stream( |