Skip to content
Myr

Support async template context processors

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This is useful as there is contextual information that could be loaded via IO e.g. information from a database. This also matches Quart and hence makes the shared signature easier to manage.

authored by pgjones · committed by pgjones · parent 72c85e8 · Browse files · 2 files+5 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+5 added−2 removed

  • other:+5 added−2 removed

2 files+5 added−2 removed

modified:src/flask/app.py+1 added-1 removed
476 unmodified lines
477478 for name in names:479 if name in self.template_context_processors:480 for func in self.template_context_processors[name]:481 context.update(func())481 context.update(self.ensure_sync(func)())482483 context.update(orig_ctx)484485 def make_shell_context(self) -> dict:
993 unmodified lines
modified:src/flask/typing.py+4 added-1 removed
59 unmodified lines
60TeardownCallable = t.Union[61 t.Callable[[t.Optional[BaseException]], None],62 t.Callable[[t.Optional[BaseException]], t.Awaitable[None]],63]64TemplateContextProcessorCallable = t.Callable[[], t.Dict[str, t.Any]]64TemplateContextProcessorCallable = t.Union[65 t.Callable[[], t.Dict[str, t.Any]],66 t.Callable[[], t.Awaitable[t.Dict[str, t.Any]]],67]68TemplateFilterCallable = t.Callable[..., t.Any]69TemplateGlobalCallable = t.Callable[..., t.Any]70TemplateTestCallable = t.Callable[..., bool]71URLDefaultCallable = t.Callable[[str, dict], None]
14 unmodified lines