As template module creation can invoke template code for asynchronous executions this method must be used instead of the normal :meth:`make_module` one. Likewise the module attribute becomes unavailable in async mode.
(
self,
vars: t.Optional[t.Dict[str, t.Any]] = None,
shared: bool = False,
locals: t.Optional[t.Mapping[str, t.Any]] = None,
)
| 1405 | return TemplateModule(self, ctx) |
| 1406 | |
| 1407 | async def make_module_async( |
| 1408 | self, |
| 1409 | vars: t.Optional[t.Dict[str, t.Any]] = None, |
| 1410 | shared: bool = False, |
| 1411 | locals: t.Optional[t.Mapping[str, t.Any]] = None, |
| 1412 | ) -> "TemplateModule": |
| 1413 | """As template module creation can invoke template code for |
| 1414 | asynchronous executions this method must be used instead of the |
| 1415 | normal :meth:`make_module` one. Likewise the module attribute |
| 1416 | becomes unavailable in async mode. |
| 1417 | """ |
| 1418 | ctx = self.new_context(vars, shared, locals) |
| 1419 | return TemplateModule( |
| 1420 | self, |
| 1421 | ctx, |
| 1422 | [x async for x in self.root_render_func(ctx)], # type: ignore |
| 1423 | ) |
| 1424 | |
| 1425 | @internalcode |
| 1426 | def _get_default_module(self, ctx: t.Optional[Context] = None) -> "TemplateModule": |
no test coverage detected