NestedDictLoader
Sub classes¶
| Name | Children | Inherits |
|---|---|---|
| TemplateFileLoader jinjarope.configloaders A jinja loader for loading templates from config files. |
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| LoaderMixin jinjarope.loaders Loader mixin which allows to OR loaders into a choice loader. |
||
| BaseLoader jinja2.loaders Baseclass for all loaders. Subclass this and override `get_source` to |
⋔ Inheritance diagram¶
graph TD
97041655680608["configloaders.NestedDictLoader"]
97041656291584["loaders.LoaderMixin"]
128674497047040["builtins.object"]
97041655470432["loaders.BaseLoader"]
97041656291584 --> 97041655680608
128674497047040 --> 97041656291584
97041655470432 --> 97041655680608
128674497047040 --> 97041655470432
🛈 DocStrings¶
Bases: LoaderMixin, BaseLoader
A jinja loader for loading templates from nested dicts.
This loader allows to access templates from nested dicts. Can be used to load templates defined with markup like TOML.
Examples:
content = tomllib.load(toml_file)
loader = NestedDictLoader(content)
env = Environment(loader=loader)
env.get_template("example/template")
Source code in src/jinjarope/configloaders.py
__init__
¶
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mapping
|
NestedMapping
|
A nested dict containing templates |
required |