Jump to >

This documentation covers the in-development release of Djblets. You can see the latest stable docs or all previous versions.

djblets.extensions.loaders

Template loaders for extensions.

class ExtensionOrigin(package, resource, *args, **kwargs)[source]

An origin for a template in an extension.

New in version 3.0.

class Loader(engine)[source]

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)[source]

Return the contents of a template.

Parameters

origin (ExtensionOrigin) – The origin of the template.

Returns

The resulting template contents.

Return type

unicode

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.