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=src_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=src_flask_sansio_app_app)
) - > None

Parameters

NameTypeDescription
app[App](../sansio/app/app.md?sid=src_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 source code for a template by dispatching to either a fast or an explained loading strategy based on the application configuration.

Parameters

NameTypeDescription
environmentBaseEnvironmentThe Jinja environment instance requesting the template source.
templatestrThe logical name 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 registered blueprints.

Returns

TypeDescription
list[str]A list of strings representing the available template paths.