Skip to content

FileSystemLoader

Base classes

Name Children Inherits
LoaderMixin
jinjarope.loaders
Loader mixin which allows to OR loaders into a choice loader.
FileSystemLoader
jinja2.loaders
Load templates from a directory in the file system.

⋔ Inheritance diagram

graph TD
  94142655680576["loaders.FileSystemLoader"]
  94142653860608["loaders.LoaderMixin"]
  140199010283712["builtins.object"]
  94142652616480["loaders.FileSystemLoader"]
  94142650643376["loaders.BaseLoader"]
  94142653860608 --> 94142655680576
  140199010283712 --> 94142653860608
  94142652616480 --> 94142655680576
  94142650643376 --> 94142652616480
  140199010283712 --> 94142650643376

🛈 DocStrings

Bases: LoaderMixin, FileSystemLoader

A loader to load templates from the file system.

Source code in src/jinjarope/loaders.py
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
class FileSystemLoader(LoaderMixin, jinja2.FileSystemLoader):
    """A loader to load templates from the file system."""

    ID = "filesystem"

    def __repr__(self):
        return utils.get_repr(self, searchpath=self.searchpath)

    def __add__(self, other) -> FileSystemLoader:
        ls = [other] if isinstance(other, jinja2.FileSystemLoader) else other.serchpath
        return FileSystemLoader([*self.searchpath, *ls])

    def __bool__(self):
        return len(self.searchpath) > 0

    def __eq__(self, other):
        return type(self) is type(other) and self.searchpath == other.searchpath

    def __hash__(self):
        return hash(tuple(self.searchpath))

Show source on GitHub