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
| Name | Type | Description |
|---|---|---|
| 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
| Name | Type | Description |
|---|---|---|
| environment | BaseEnvironment | The Jinja2 environment in which the template is being loaded. |
| template | str | The name or path of the template to load. |
Returns
| Type | Description |
|---|---|
| `tuple[str, str | None, 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
| Type | Description |
|---|---|
list[str] | A list of strings, where each string is the name or path of a template. |