Auto-mount defpages: eliminate Python route stubs across all 9 services
Defpages are now declared with absolute paths in .sx files and auto-mounted directly on the Quart app, removing ~850 lines of blueprint mount_pages calls, before_request hooks, and g.* wrapper boilerplate. A new page = one defpage declaration, nothing else. Infrastructure: - async_eval awaits coroutine results from callable dispatch - auto_mount_pages() mounts all registered defpages on the app - g._defpage_ctx pattern passes helper data to layout context Migrated: sx, account, orders, federation, cart, market, events, blog Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,89 +1,89 @@
|
||||
;; Events pages — mounted on various nested blueprints
|
||||
;; Events pages — auto-mounted with absolute paths
|
||||
|
||||
;; Calendar admin (mounted on calendar.admin bp)
|
||||
;; Calendar admin
|
||||
(defpage calendar-admin
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/admin/"
|
||||
:auth :admin
|
||||
:layout :events-calendar-admin
|
||||
:content (calendar-admin-content))
|
||||
:content (calendar-admin-content calendar-slug))
|
||||
|
||||
;; Day admin (mounted on day.admin bp)
|
||||
;; Day admin
|
||||
(defpage day-admin
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/day/<int:year>/<int:month>/<int:day>/admin/"
|
||||
:auth :admin
|
||||
:layout :events-day-admin
|
||||
:content (day-admin-content))
|
||||
:content (day-admin-content calendar-slug year month day))
|
||||
|
||||
;; Slots listing (mounted on slots bp)
|
||||
;; Slots listing
|
||||
(defpage slots-listing
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/slots/"
|
||||
:auth :public
|
||||
:layout :events-slots
|
||||
:content (slots-content))
|
||||
:content (slots-content calendar-slug))
|
||||
|
||||
;; Slot detail (mounted on slot bp)
|
||||
;; Slot detail
|
||||
(defpage slot-detail
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/slots/<int:slot_id>/"
|
||||
:auth :admin
|
||||
:layout :events-slot
|
||||
:content (slot-content))
|
||||
:content (slot-content calendar-slug slot-id))
|
||||
|
||||
;; Entry detail (mounted on calendar_entry bp)
|
||||
;; Entry detail
|
||||
(defpage entry-detail
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/day/<int:year>/<int:month>/<int:day>/entries/<int:entry_id>/"
|
||||
:auth :admin
|
||||
:layout :events-entry
|
||||
:content (entry-content)
|
||||
:menu (entry-menu))
|
||||
:content (entry-content calendar-slug entry-id)
|
||||
:menu (entry-menu calendar-slug entry-id))
|
||||
|
||||
;; Entry admin (mounted on calendar_entry.admin bp)
|
||||
;; Entry admin
|
||||
(defpage entry-admin
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/day/<int:year>/<int:month>/<int:day>/entries/<int:entry_id>/admin/"
|
||||
:auth :admin
|
||||
:layout :events-entry-admin
|
||||
:content (entry-admin-content)
|
||||
:content (entry-admin-content calendar-slug entry-id)
|
||||
:menu (admin-menu))
|
||||
|
||||
;; Ticket types listing (mounted on ticket_types bp)
|
||||
;; Ticket types listing
|
||||
(defpage ticket-types-listing
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/day/<int:year>/<int:month>/<int:day>/entries/<int:entry_id>/ticket-types/"
|
||||
:auth :public
|
||||
:layout :events-ticket-types
|
||||
:content (ticket-types-content)
|
||||
:content (ticket-types-content calendar-slug entry-id year month day)
|
||||
:menu (admin-menu))
|
||||
|
||||
;; Ticket type detail (mounted on ticket_type bp)
|
||||
;; Ticket type detail
|
||||
(defpage ticket-type-detail
|
||||
:path "/"
|
||||
:path "/<slug>/<calendar_slug>/day/<int:year>/<int:month>/<int:day>/entries/<int:entry_id>/ticket-types/<int:ticket_type_id>/"
|
||||
:auth :admin
|
||||
:layout :events-ticket-type
|
||||
:content (ticket-type-content)
|
||||
:content (ticket-type-content calendar-slug entry-id ticket-type-id year month day)
|
||||
:menu (admin-menu))
|
||||
|
||||
;; My tickets (mounted on tickets bp)
|
||||
;; My tickets
|
||||
(defpage my-tickets
|
||||
:path "/"
|
||||
:path "/tickets/"
|
||||
:auth :public
|
||||
:layout :root
|
||||
:content (tickets-content))
|
||||
|
||||
;; Ticket detail (mounted on tickets bp)
|
||||
;; Ticket detail
|
||||
(defpage ticket-detail
|
||||
:path "/<code>/"
|
||||
:path "/tickets/<code>/"
|
||||
:auth :public
|
||||
:layout :root
|
||||
:content (ticket-detail-content))
|
||||
:content (ticket-detail-content code))
|
||||
|
||||
;; Ticket admin dashboard (mounted on ticket_admin bp)
|
||||
;; Ticket admin dashboard
|
||||
(defpage ticket-admin
|
||||
:path "/"
|
||||
:path "/admin/tickets/"
|
||||
:auth :admin
|
||||
:layout :root
|
||||
:content (ticket-admin-content))
|
||||
|
||||
;; Markets (mounted on markets bp)
|
||||
;; Markets
|
||||
(defpage events-markets
|
||||
:path "/"
|
||||
:path "/<slug>/markets/"
|
||||
:auth :public
|
||||
:layout :events-markets
|
||||
:content (markets-content))
|
||||
|
||||
Reference in New Issue
Block a user