djblets.extensions.loaders¶
Template loaders for extensions.
- class ExtensionOrigin(package, resource, *args, **kwargs)[source]¶
Bases:
Origin
An origin for a template in an extension.
New in version 3.0.
- class Loader(engine)[source]¶
Bases:
Loader
Loads templates found within an extension.
This will look through all enabled extensions and attempt to fetch the named template under the
templates
directory within the extension’s package.This should be added last to the list of template loaders.
New in version 0.9.
- get_contents(origin: ExtensionOrigin) str [source]¶
Return the contents of a template.
- Parameters:
origin (
ExtensionOrigin
) – The origin of the template.- Returns:
The resulting template contents.
- Return type:
- Raises:
TemplateDoesNotExist – The template could not be found.
- get_template_sources(template_name)[source]¶
Load templates from enabled extensions.
- Parameters:
template_name (
unicode
) – The name of the template to load.- Yields:
ExtensionOrigin
– Each possible location for the template.