Skip to main content

DispatchingJinjaLoader

A loader that looks for templates in the application and all the blueprint folders.

Constructor

Signature

def DispatchingJinjaLoader(
app: [App](../sansio/app/app.md?sid=flask_sansio_app_app)
) - > null

Parameters

NameTypeDescription
app[App](../sansio/app/app.md?sid=flask_sansio_app_app)The application instance.

Methods


get_source()

@classmethod
def get_source(
environment: BaseEnvironment,
template: str
) - > tuple[str, str | None, t.Callable[[], bool]| None]

Fetches the source for a given template. If template loading explanation is enabled in the application configuration, it calls an internal method to provide detailed loading attempts; otherwise, it uses a faster internal method.

Parameters

NameTypeDescription
environmentBaseEnvironmentThe Jinja2 environment in which the template is being loaded.
templatestrThe name or path of the template to load.

Returns

TypeDescription
`tuple[str, strNone, t.Callable[[], bool]

list_templates()

@classmethod
def list_templates() - > list[str]

Lists all templates known to the application's main Jinja loader and all Jinja loaders associated with registered blueprints. This provides a comprehensive list of all discoverable templates.

Returns

TypeDescription
list[str]A list of strings, where each string is the name or path of a template.