diff options
author | Daniel Stone <me@danstone.uk> | 2021-09-18 16:24:10 +0100 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-10-04 13:49:13 -0700 |
commit | baff54fe1d7b74c9fa8adb9d1324a77b8a2640ad (patch) | |
tree | 8c9e1a623767cd9a4038fd14110da15207ed88e6 /src/jinja2/compiler.py | |
parent | fb9cac66e94f5acb68828aae0b1cd5bbfedf191f (diff) | |
download | jinja2-baff54fe1d7b74c9fa8adb9d1324a77b8a2640ad.tar.gz |
imported macros can access template globals in async mode
Diffstat (limited to 'src/jinja2/compiler.py')
-rw-r--r-- | src/jinja2/compiler.py | 4 |
1 files changed, 1 insertions, 3 deletions
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.""" |