jinja2.PrefixLoader

class jinja2.PrefixLoader(mapping, delimiter='/')[source]

A loader that is passed a dict of loaders where each loader is bound to a prefix. The prefix is delimited from the template by a slash per default, which can be changed by setting the delimiter argument to something else:

loader = PrefixLoader({
    'app1':     PackageLoader('mypackage.app1'),
    'app2':     PackageLoader('mypackage.app2')
})

By loading 'app1/index.html' the file from the app1 package is loaded, by loading 'app2/index.html' the file from the second.

Methods

__init__(mapping[, delimiter])
get_loader(template)
get_source(environment, template)
list_templates()
load(environment, name[, globals])

Attributes

has_source_access