Async support for prepare_jinja2_environment, closes #1809

This commit is contained in:
Simon Willison 2022-09-16 20:38:15 -07:00
commit ddc999ad12
10 changed files with 76 additions and 9 deletions

View file

@ -126,6 +126,12 @@ def permission_allowed(datasette, actor, action):
return inner
@hookimpl
def prepare_jinja2_environment(env, datasette):
env.filters["format_numeric"] = lambda s: f"{float(s):,.0f}"
env.filters["to_hello"] = lambda s: datasette._HELLO
@hookimpl
def startup(datasette):
async def inner():