Closed rwielk closed 10 months ago
_uptodate
has behaved the same way for 16 years, see the blame view on that line you identified: https://github.com/pallets/jinja/blame/main/src/jinja2/environment.py#L1496 It must be None
or a callable, None
indicates it's always up to date.
Sorry, just misread the typehints, thanks for your quick response.
Just in case anyone stumbles into this via googe or so:
https://github.com/peering-manager/peering-manager/pull/783
fixes this in this case at the right location which is not jinja here, my bad.
environment.py::Template::is_up_to_date (https://github.com/pallets/jinja/blob/main/src/jinja2/environment.py#L1496) tries to call self._uptodate even if this correctly is a boolean and not callable, disallowing to correctly implement BaseLoader::get_source with an alway up_to_date get_source like here: https://github.com/peering-manager/peering-manager/blob/main/peering_manager/jinja2/loaders.py#L48
Overwrite a BaseLoaders get_source method returning a bool as last value as type hints allow and include template twice with cache enabled like here: https://github.com/peering-manager/peering-manager/blob/main/peering_manager/jinja2/loaders.py#L6
Untested example code snippet:
Example trace
Respect bools value and do not call it.
Environment:
MR incoming...