issue_comments: 1247314352
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/1809#issuecomment-1247314352 | https://api.github.com/repos/simonw/datasette/issues/1809 | 1247314352 | IC_kwDOBm6k_c5KWIGw | 9599 | 2022-09-14T21:20:12Z | 2022-09-14T21:20:12Z | OWNER | The reason to support `await_me_maybe` is in case a hook wants to execute a SQL query as part of configuring the Jinja template loader. That's exactly what `datasette-edit-templates` needs to do, though it's currently achieving that in a `startup()` hook instead: https://github.com/simonw/datasette-edit-templates/blob/087f6a6cabc20020f2b0524f11aa3a7836320848/datasette_edit_templates/__init__.py#L32-L48 ```python @hookimpl def startup(datasette): datasette._edit_templates = {} async def inner(): db = get_database(datasette) # Does the table exist? if not await db.table_exists(TABLE): for sql in CREATE_TABLE: await db.execute_write(sql, block=True) else: # Load all templates from that table rows = await db.execute("select template, body FROM {}".format(TABLE)) for name, content in rows: datasette._edit_templates[name] = content return inner ``` | {"total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0} | 1373595927 |