From 635acc9312718e76f6c3a5ddae12e17cd05c0cfc Mon Sep 17 00:00:00 2001 From: un-pogaz <46523284+un-pogaz@users.noreply.github.com> Date: Fri, 14 Oct 2022 10:30:43 +0200 Subject: [PATCH] sef caller in __init__ --- src/calibre/utils/formatter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/calibre/utils/formatter.py b/src/calibre/utils/formatter.py index 741d908173..4c64784516 100644 --- a/src/calibre/utils/formatter.py +++ b/src/calibre/utils/formatter.py @@ -1542,6 +1542,7 @@ class TemplateFormatter(string.Formatter): self.funcs = formatter_functions().get_functions() self._interpreters = [] self._template_parser = None + self._caller = FormatterFuncsCaller(self) self.recursion_stack = [] self.recursion_level = -1 @@ -1857,7 +1858,6 @@ class TemplateFormatter(string.Formatter): self.python_context_object = python_context_object else: self.python_context_object = PythonTemplateContext() - self._caller = FormatterFuncsCaller(self) return self.evaluate(fmt, [], kwargs, self.global_vars) finally: self.restore_state(state) @@ -1890,7 +1890,6 @@ class TemplateFormatter(string.Formatter): else: self.funcs = formatter_functions().get_functions() self.locals = {} - self._caller = FormatterFuncsCaller(self) try: ans = self.evaluate(fmt, [], kwargs, self.global_vars, break_reporter=break_reporter) except StopException as e: