Fix loader overwriting
In cases when there are many j2 templates and some of them use include tags, correct jinja loader is overriden with one of loaders related to other templates. This patch fixes it with workaround. Which is overwrite incorrect loader with initial. Change-Id: Iec21c24fe6e4bfedf281d7215e520298381f07a7
This commit is contained in:
parent
b67c0bc754
commit
87af31a313
@ -527,8 +527,13 @@ class Jinja2Loader(CustomLoader):
|
||||
self._template.environment.undefined = jinja2.StrictUndefined
|
||||
self._template.environment.loader = jinja2.FileSystemLoader(
|
||||
search_path)
|
||||
self._loader = self._template.environment.loader
|
||||
|
||||
def format(self, **kwargs):
|
||||
# For some reasons loader is overwritten with incorrect one during
|
||||
# instance lifecycle. It's not very clear how to fix this properly,
|
||||
# so we just overwrite with correct one
|
||||
self._template.environment.loader = self._loader
|
||||
return self._template.render(kwargs)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user