PackageLoader
Base classes¶
Name | Children | Inherits |
---|---|---|
LoaderMixin jinjarope.loaders Loader mixin which allows to OR loaders into a choice loader. |
||
PackageLoader jinja2.loaders Load templates from a directory in a Python package. |
⋔ Inheritance diagram¶
graph TD
94142655678800["loaders.PackageLoader"]
94142653860608["loaders.LoaderMixin"]
140199010283712["builtins.object"]
94142654945104["loaders.PackageLoader"]
94142650643376["loaders.BaseLoader"]
94142653860608 --> 94142655678800
140199010283712 --> 94142653860608
94142654945104 --> 94142655678800
94142650643376 --> 94142654945104
140199010283712 --> 94142650643376
🛈 DocStrings¶
Bases: LoaderMixin
, PackageLoader
A loader for loading templates from a package.
Source code in src/jinjarope/loaders.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
__init__
¶
__init__(
package: str | ModuleType, package_path: str | None = None, encoding: str = "utf-8"
) -> None
Instanciate a PackageLoader.
Compared to the jinja2 equivalent, this loader also supports
ModuleType
s and dotted module paths for the package
argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package
|
str | ModuleType
|
The python package to create a loader for |
required |
package_path
|
str | None
|
If given, use the given path as the root. |
None
|
encoding
|
str
|
The encoding to use for loading templates |
'utf-8'
|
Source code in src/jinjarope/loaders.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|