Skip to content

FunctionLoader

Base classes

Name Children Inherits
LoaderMixin
jinjarope.loaders
Loader mixin which allows to OR loaders into a choice loader.
FunctionLoader
jinja2.loaders
A loader that is passed a function which does the loading. The

⋔ Inheritance diagram

graph TD
  94173637904112["loaders.FunctionLoader"]
  94173637890544["loaders.LoaderMixin"]
  139866058043616["builtins.object"]
  94173636340592["loaders.FunctionLoader"]
  94173636407456["loaders.BaseLoader"]
  94173637890544 --> 94173637904112
  139866058043616 --> 94173637890544
  94173636340592 --> 94173637904112
  94173636407456 --> 94173636340592
  139866058043616 --> 94173636407456

🛈 DocStrings

Bases: LoaderMixin, FunctionLoader

A loader for loading templates from a function.

The function takes a template path as parameter and either returns a (text, None, uptodate_fn) tuple or just the text as str.

Source code in src/jinjarope/loaders.py
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
class FunctionLoader(LoaderMixin, jinja2.FunctionLoader):
    """A loader for loading templates from a function.

    The function takes a template path as parameter and either returns
    a (text, None, uptodate_fn) tuple or just the text as str.
    """

    ID = "function"

    def __repr__(self):
        return utils.get_repr(self, self.load_func)

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

    def __hash__(self):
        return hash(self.load_func)

Show source on GitHub