From baff54fe1d7b74c9fa8adb9d1324a77b8a2640ad Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Sat, 18 Sep 2021 16:24:10 +0100 Subject: imported macros can access template globals in async mode --- src/jinja2/compiler.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/jinja2/compiler.py') diff --git a/src/jinja2/compiler.py b/src/jinja2/compiler.py index b629720..52fd5b8 100644 --- a/src/jinja2/compiler.py +++ b/src/jinja2/compiler.py @@ -1090,10 +1090,8 @@ class CodeGenerator(NodeVisitor): self.write( f"{f_name}(context.get_all(), True, {self.dump_local_context(frame)})" ) - elif self.environment.is_async: - self.write("_get_default_module_async()") else: - self.write("_get_default_module(context)") + self.write(f"_get_default_module{self.choose_async('_async')}(context)") def visit_Import(self, node: nodes.Import, frame: Frame) -> None: """Visit regular imports.""" -- cgit v1.2.1