Skip to main content

DispatchingJinjaLoader

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

Attributes

AttributeTypeDescription
app[App](../sansio/app/app.md?sid=flask_sansio_app_app)The application instance used to access configuration settings and iterate through registered blueprints for template loading.

Constructor

Signature

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

Parameters

NameTypeDescription
app[App](../sansio/app/app.md?sid=flask_sansio_app_app)The Flask application instance used to access configuration and loaders.

Methods


get_source()

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

Retrieves the template source code by dispatching the request to either a fast or an explained loading mechanism based on the application configuration.

Parameters

NameTypeDescription
environmentBaseEnvironmentThe Jinja environment instance requesting the template source.
templatestrThe logical name or path of the template to be loaded.

Returns

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

list_templates()

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

Aggregates and returns a unique list of all template names available across the application and all its blueprints.

Returns

TypeDescription
list[str]A list of unique template paths found in all active loaders.