Support async template context processors

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.
This commit is contained in:
pgjones 2023-07-15 23:21:12 +01:00
parent 72c85e80c8
commit 3f6b243cec
2 changed files with 5 additions and 2 deletions

View file

@ -478,7 +478,7 @@ class Flask(App):
for name in names:
if name in self.template_context_processors:
for func in self.template_context_processors[name]:
context.update(func())
context.update(self.ensure_sync(func)())
context.update(orig_ctx)