class documentation
class ModuleLoader(BaseLoader): (source)
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 |
Undocumented |
Static Method | get |
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 |
Undocumented |
Instance Variable | module |
Undocumented |
Instance Variable | package |
Undocumented |
Inherited from BaseLoader
:
Method | get |
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 |
Iterates over all templates. If the loader does not support that it should raise a :exc:`TypeError` which is the default behavior. |
Undocumented
Parameters | |
path:t.Union[ | Undocumented |
overrides
jinja2.loaders.BaseLoader.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.
Parameters | |
environment:Environment | Undocumented |
name:str | Undocumented |
globals:t.Optional[ | Undocumented |
Returns | |
Template | Undocumented |