Auto-mount fragment handlers: eliminate fragment blueprint boilerplate across all 8 services
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 16m38s

Fragment read API is now fully declarative — every handler is a defhandler
s-expression dispatched through one shared auto_mount_fragment_handlers()
function. Replaces 8 near-identical blueprint files (~35 lines each) with
a single function call per service. Events Python handlers (container-cards,
account-page) extracted to a standalone module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 19:13:15 +00:00
parent 293f7713d6
commit e30cb0a992
34 changed files with 126 additions and 386 deletions

View File

@@ -9,7 +9,7 @@ from jinja2 import FileSystemLoader, ChoiceLoader
from shared.infrastructure.factory import create_base_app
from bp import register_all_events, register_calendar, register_calendars, register_markets, register_page, register_fragments, register_actions, register_data
from bp import register_all_events, register_calendar, register_calendars, register_markets, register_page, register_actions, register_data
async def events_context() -> dict:
@@ -112,7 +112,12 @@ def create_app() -> "Quart":
url_prefix="/<slug>/markets",
)
app.register_blueprint(register_fragments())
from shared.sx.handlers import auto_mount_fragment_handlers
from bp.fragments.python_handlers import container_cards_handler, account_page_handler
add_fragment_handler = auto_mount_fragment_handlers(app, "events")
add_fragment_handler("container-cards", container_cards_handler, content_type="text/html")
add_fragment_handler("account-page", account_page_handler)
app.register_blueprint(register_actions())
app.register_blueprint(register_data())