jinja2.sandbox.ImmutableSandboxedEnvironment.list_templates

ImmutableSandboxedEnvironment.list_templates(extensions=None, filter_func=None)

Returns a list of templates for this environment. This requires that the loader supports the loader’s list_templates() method.

If there are other files in the template folder besides the actual templates, the returned list can be filtered. There are two ways: either extensions is set to a list of file extensions for templates, or a filter_func can be provided which is a callable that is passed a template name and should return True if it should end up in the result list.

If the loader does not support that, a TypeError is raised.

New in version 2.4.