Added centralized templating system with static asset serving.
CI / Formatting (push) Successful in 13s
CI / Linting (push) Successful in 14s
CI / Tests (Python 3.12) (push) Failing after 29s
CI / Tests (Python 3.13) (push) Failing after 29s
CI / Tests (Python 3.14) (push) Failing after 26s
CI / Type Checking (push) Failing after 25s
CI / Spelling (push) Successful in 13s

This commit is contained in:
2026-02-27 10:05:52 -05:00
parent 4e2c8b4d67
commit 410c0cd791
14 changed files with 238 additions and 152 deletions
+1 -11
View File
@@ -18,9 +18,7 @@ Allows moderators to store quotes and anyone to recall random quotes.
"""
from datetime import UTC, datetime
from pathlib import Path
import jinja2
from aiohttp import web
from owlbot.api import (
@@ -32,12 +30,6 @@ from owlbot.api import (
on_setup,
)
_template_dir = Path(__file__).resolve().parent / "templates"
_jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(_template_dir),
autoescape=True,
)
@on_setup
async def setup(ctx: ModuleContext) -> None:
@@ -84,9 +76,7 @@ async def quotes_list_page(ctx: RouteContext) -> web.Response:
for row in rows
]
template = _jinja_env.get_template("list.html")
page = template.render(quotes=quotes)
page = ctx.templates.render("list.html", quotes=quotes)
return web.Response(text=page, content_type="text/html")