DictLoader Class

Inheritance diagram of DictLoader

class DictLoader(mapping)

Loads a template from a python dict. It’s passed a dict of unicode strings bound to template names. This loader is useful for unittesting:

>>> loader = DictLoader({'index.html': 'source here'})

Because auto reloading is rarely useful this is disabled per default.


get_source(environment, template)
load(environment, name[, globals]) Loads a template.


has_source_access bool(x) -> bool


class DictLoader

Method details

get_source(environment, template)

Inherited member details

load(environment, name, globals=None)

Loads a template. This method looks up the template in the cache or loads one by calling get_source(). Subclasses should not override this method as loaders working on collections of other loaders (such as PrefixLoader or ChoiceLoader) will not call this method but get_source directly.

has_source_access = True

Table Of Contents

Previous topic

ChoiceLoader Class

Next topic

FileSystemLoader Class