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
94142655718000["configloaders.NestedDictLoader"]
94142653860608["loaders.LoaderMixin"]
140199010283712["builtins.object"]
94142650643376["loaders.BaseLoader"]
94142653860608 --> 94142655718000
140199010283712 --> 94142653860608
94142650643376 --> 94142655718000
140199010283712 --> 94142650643376
🛈 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:
[example]
template = "{{ something }}"
content = tomllib.load(toml_file)
loader = NestedDictLoader(content)
env = Environment(loader=loader)
env.get_template("example/template")
Source code in src/jinjarope/configloaders.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
__init__
¶
__init__(mapping: NestedMapping)
Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mapping
|
NestedMapping
|
A nested dict containing templates |
required |
Source code in src/jinjarope/configloaders.py
39 40 41 42 43 44 45 46 |
|