class documentation

class ModuleLoader(BaseLoader): (source)

View In Hierarchy

This loader loads templates from precompiled templates. Example usage: >>> loader = ChoiceLoader([ ... ModuleLoader('/path/to/compiled/templates'), ... FileSystemLoader('/path/to/templates') ... ]) Templates can be precompiled with :meth:`Environment.compile_templates`.

Static Method get_module_filename Undocumented
Static Method get_template_key Undocumented
Method __init__ Undocumented
Method load Loads a template. This method looks up the template in the cache or loads one by calling :meth:`get_source`. Subclasses should not override this method as loaders working on collections of other loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`) will not call this method but `get_source` directly.
Class Variable has_source_access Undocumented
Instance Variable module Undocumented
Instance Variable package_name Undocumented

Inherited from BaseLoader:

Method get_source Get the template source, filename and reload helper for a template. It's passed the environment and template name and has to return a tuple in the form ``(source, filename, uptodate)`` or raise a `TemplateNotFound` error if it can't locate the template.
Method list_templates Iterates over all templates. If the loader does not support that it should raise a :exc:`TypeError` which is the default behavior.
@staticmethod
def get_module_filename(name): (source)

Undocumented

Parameters
name:strUndocumented
Returns
strUndocumented
@staticmethod
def get_template_key(name): (source)

Undocumented

Parameters
name:strUndocumented
Returns
strUndocumented
def __init__(self, path): (source)

Undocumented

Parameters
path:t.Union[str, os.PathLike, t.Sequence[t.Union[str, os.PathLike]]]Undocumented
@internalcode
def load(self, environment, name, globals=None): (source)

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

Parameters
environment:EnvironmentUndocumented
name:strUndocumented
globals:t.Optional[t.MutableMapping[str, t.Any]]Undocumented
Returns
TemplateUndocumented
has_source_access: bool = (source)
module = (source)

Undocumented

package_name = (source)

Undocumented