Render a template by name with the given context. :param template_name_or_list: The name of the template to render. If a list is given, the first name to exist will be rendered. :param context: The variables to make available in the template.
(
template_name_or_list: str | Template | list[str | Template],
**context: t.Any,
)
| 137 | |
| 138 | |
| 139 | def render_template( |
| 140 | template_name_or_list: str | Template | list[str | Template], |
| 141 | **context: t.Any, |
| 142 | ) -> str: |
| 143 | """Render a template by name with the given context. |
| 144 | |
| 145 | :param template_name_or_list: The name of the template to render. If |
| 146 | a list is given, the first name to exist will be rendered. |
| 147 | :param context: The variables to make available in the template. |
| 148 | """ |
| 149 | app = current_app._get_current_object() # type: ignore[attr-defined] |
| 150 | template = app.jinja_env.get_or_select_template(template_name_or_list) |
| 151 | return _render(app, template, context) |
| 152 | |
| 153 | |
| 154 | def render_template_string(source: str, **context: t.Any) -> str: |
no test coverage detected
searching dependent graphs…