Path 1: 30 calls (0.94)

'template_filter.html' (9) 'template_test.html' (9) 'simple_template.html' (2) 'frontend/index.html' (1) 'admin/index.html' (1) './admin/index.html' (...

{'value': 'abcd'} (9) {'value': False} (9) {} (5) {'whiskey': 42} (2) {'value': 23} (2) dict (2) {'foo': ''} (1)

'dcba' (9) '\n Success!\n' (9) 'Hello from the Admin' (2) 'Hello from the Frontend' (1) "I'm nested" (1) '

42

' (1) '

43

' (1) '

23...

1def render_template(
2    template_name_or_list: str | Template | list[str | Template],
3    **context: t.Any,
4) -> str:
5    """Render a template by name with the given context.
6
7    :param template_name_or_list: The name of the template to render. If
8        a list is given, the first name to exist will be rendered.
9    :param context: The variables to make available in the template.
10    """
11    app = current_app._get_current_object()  # type: ignore[attr-defined]
12    template = app.jinja_env.get_or_select_template(template_name_or_list)
13    return _render(app, template, context)
            

Path 2: 2 calls (0.06)

'missing.html' (1) 'missing_template.html' (1)

{} (2)

TemplateNotFound (2)

1def render_template(
2    template_name_or_list: str | Template | list[str | Template],
3    **context: t.Any,
4) -> str:
5    """Render a template by name with the given context.
6
7    :param template_name_or_list: The name of the template to render. If
8        a list is given, the first name to exist will be rendered.
9    :param context: The variables to make available in the template.
10    """
11    app = current_app._get_current_object()  # type: ignore[attr-defined]
12    template = app.jinja_env.get_or_select_template(template_name_or_list)
13    return _render(app, template, context)