Phase 6: Replace render_template() with s-expression rendering in all GET routes
Migrate ~52 GET route handlers across all 7 services from Jinja render_template() to s-expression component rendering. Each service gets a sexp_components.py with page/oob/cards render functions. - Add per-service sexp_components.py (account, blog, cart, events, federation, market, orders) with full page, OOB, and pagination card rendering - Add shared/sexp/helpers.py with call_url, root_header_html, full_page, oob_page utilities - Update all GET routes to use get_template_context() + render fns - Fix get_template_context() to inject Jinja globals (URL helpers) - Add qs_filter to base_context for sexp filter URL building - Mount sexp_components.py in docker-compose.dev.yml for all services - Import sexp_components in app.py for Hypercorn --reload watching - Fix route_prefix import (shared.utils not shared.infrastructure.urls) - Fix federation choose-username missing actor in context - Fix market page_markets missing post in context Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from shared.browser.app.payments.sumup import create_checkout as sumup_create_ch
|
||||
from shared.config import config
|
||||
|
||||
from shared.infrastructure.cart_identity import current_cart_identity
|
||||
from shared.sexp.page import get_template_context
|
||||
from services.check_sumup_status import check_sumup_status
|
||||
from shared.browser.app.utils.htmx import is_htmx_request
|
||||
|
||||
@@ -46,10 +47,16 @@ def register() -> Blueprint:
|
||||
order = result.scalar_one_or_none()
|
||||
if not order:
|
||||
return await make_response("Order not found", 404)
|
||||
|
||||
from sexp_components import render_order_page, render_order_oob
|
||||
|
||||
ctx = await get_template_context()
|
||||
calendar_entries = ctx.get("calendar_entries")
|
||||
|
||||
if not is_htmx_request():
|
||||
html = await render_template("_types/order/index.html", order=order)
|
||||
html = await render_order_page(ctx, order, calendar_entries, url_for)
|
||||
else:
|
||||
html = await render_template("_types/order/_oob_elements.html", order=order)
|
||||
html = await render_order_oob(ctx, order, calendar_entries, url_for)
|
||||
return await make_response(html)
|
||||
|
||||
@bp.get("/pay/")
|
||||
|
||||
Reference in New Issue
Block a user