mirror of
https://gitee.com/openharmony/third_party_jinja2
synced 2025-03-04 05:17:17 +00:00
parent
c0c3b7879e
commit
2c49d14cec
@ -70,14 +70,3 @@ __all__ = [
|
||||
'evalcontextfilter', 'evalcontextfunction', 'make_logging_undefined',
|
||||
'select_autoescape',
|
||||
]
|
||||
|
||||
|
||||
def _patch_async():
|
||||
from jinja2.utils import have_async_gen
|
||||
if have_async_gen:
|
||||
from jinja2.asyncsupport import patch_all
|
||||
patch_all()
|
||||
|
||||
|
||||
_patch_async()
|
||||
del _patch_async
|
||||
|
@ -254,3 +254,6 @@ async def make_async_loop_context(iterable, undefined, recurse=None, depth0=0):
|
||||
after = _last_iteration
|
||||
return AsyncLoopContext(async_iterator, undefined, after, length, recurse,
|
||||
depth0)
|
||||
|
||||
|
||||
patch_all()
|
||||
|
@ -334,6 +334,8 @@ class Environment(object):
|
||||
|
||||
self.enable_async = enable_async
|
||||
self.is_async = self.enable_async and have_async_gen
|
||||
if self.is_async:
|
||||
import jinja2.asyncsupport # runs patch_all() once
|
||||
|
||||
_environment_sanity_check(self)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user