Closed Slarag closed 1 year ago
Would it be an option to add an optional boolean parameter "reload" to init_docx()
to fix the behavior of get_undeclared_template_variables()
?
def init_docx(self, reload: bool = True):
if not self.docx or (self.is_rendered and reload):
self.docx = Document(self.template_file)
self.is_rendered = False
...
def get_undeclared_template_variables(self, jinja_env: Optional[Environment] = None) -> Set[str]:
self.init_docx(reload=False)
...
Good idea, I will code that.
This is not a good PR : the goal of the test you modified was to force reload of template to avoid conflict with previous rendering.