Replace sx_call() with render_to_sx() across all services
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m6s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m6s
Python no longer generates s-expression strings. All SX rendering now goes through render_to_sx() which builds AST from native Python values and evaluates via async_eval_to_sx() — no SX string literals in Python. - Add render_to_sx()/render_to_html() infrastructure in shared/sx/helpers.py - Add (abort status msg) IO primitive in shared/sx/primitives_io.py - Convert all 9 services: ~650 sx_call() invocations replaced - Convert shared helpers (root_header_sx, full_page_sx, etc.) to async - Fix likes service import bug (likes.models → models) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -49,7 +49,7 @@ def register():
|
||||
from shared.sx.page import get_template_context
|
||||
from sx.sx_components import render_cart_payments_panel
|
||||
ctx = await get_template_context()
|
||||
html = render_cart_payments_panel(ctx)
|
||||
html = await render_cart_payments_panel(ctx)
|
||||
return sx_response(html)
|
||||
|
||||
return bp
|
||||
|
||||
@@ -16,9 +16,9 @@ from shared.sx.helpers import (
|
||||
post_header_sx as _shared_post_header_sx,
|
||||
search_desktop_sx, search_mobile_sx,
|
||||
full_page_sx, oob_page_sx, header_child_sx,
|
||||
sx_call, SxExpr,
|
||||
render_to_sx,
|
||||
)
|
||||
from shared.sx.parser import serialize
|
||||
from shared.sx.parser import SxExpr
|
||||
from shared.infrastructure.urls import cart_url
|
||||
|
||||
# Load cart-specific .sx components + handlers at import time
|
||||
@@ -69,12 +69,12 @@ async def _post_header_sx(ctx: dict, page_post: Any, *, oob: bool = False) -> st
|
||||
"""Build post-level header row from page_post DTO, using shared helper."""
|
||||
ctx = _ensure_post_ctx(ctx, page_post)
|
||||
ctx = await _ensure_container_nav(ctx)
|
||||
return _shared_post_header_sx(ctx, oob=oob)
|
||||
return await _shared_post_header_sx(ctx, oob=oob)
|
||||
|
||||
|
||||
def _cart_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
async def _cart_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
"""Build the cart section header row."""
|
||||
return sx_call(
|
||||
return await render_to_sx(
|
||||
"menu-row-sx",
|
||||
id="cart-row", level=1, colour="sky",
|
||||
link_href=call_url(ctx, "cart_url", "/"),
|
||||
@@ -83,17 +83,17 @@ def _cart_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
)
|
||||
|
||||
|
||||
def _page_cart_header_sx(ctx: dict, page_post: Any, *, oob: bool = False) -> str:
|
||||
async def _page_cart_header_sx(ctx: dict, page_post: Any, *, oob: bool = False) -> str:
|
||||
"""Build the per-page cart header row."""
|
||||
slug = page_post.slug if page_post else ""
|
||||
title = ((page_post.title if page_post else None) or "")[:160]
|
||||
label_parts = []
|
||||
if page_post and page_post.feature_image:
|
||||
label_parts.append(sx_call("cart-page-label-img", src=page_post.feature_image))
|
||||
label_parts.append(await render_to_sx("cart-page-label-img", src=page_post.feature_image))
|
||||
label_parts.append(f'(span "{escape(title)}")')
|
||||
label_sx = "(<> " + " ".join(label_parts) + ")"
|
||||
nav_sx = sx_call("cart-all-carts-link", href=call_url(ctx, "cart_url", "/"))
|
||||
return sx_call(
|
||||
nav_sx = await render_to_sx("cart-all-carts-link", href=call_url(ctx, "cart_url", "/"))
|
||||
return await render_to_sx(
|
||||
"menu-row-sx",
|
||||
id="page-cart-row", level=2, colour="sky",
|
||||
link_href=call_url(ctx, "cart_url", f"/{slug}/"),
|
||||
@@ -102,26 +102,26 @@ def _page_cart_header_sx(ctx: dict, page_post: Any, *, oob: bool = False) -> str
|
||||
)
|
||||
|
||||
|
||||
def _auth_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
async def _auth_header_sx(ctx: dict, *, oob: bool = False) -> str:
|
||||
"""Build the account section header row (for orders)."""
|
||||
return sx_call(
|
||||
return await render_to_sx(
|
||||
"auth-header-row-simple",
|
||||
account_url=call_url(ctx, "account_url", ""),
|
||||
oob=oob,
|
||||
)
|
||||
|
||||
|
||||
def _orders_header_sx(ctx: dict, list_url: str) -> str:
|
||||
async def _orders_header_sx(ctx: dict, list_url: str) -> str:
|
||||
"""Build the orders section header row."""
|
||||
return sx_call("orders-header-row", list_url=list_url)
|
||||
return await render_to_sx("orders-header-row", list_url=list_url)
|
||||
|
||||
|
||||
def _cart_page_admin_header_sx(ctx: dict, page_post: Any, *, oob: bool = False,
|
||||
async def _cart_page_admin_header_sx(ctx: dict, page_post: Any, *, oob: bool = False,
|
||||
selected: str = "") -> str:
|
||||
"""Build the page-level admin header row."""
|
||||
slug = page_post.slug if page_post else ""
|
||||
ctx = _ensure_post_ctx(ctx, page_post)
|
||||
return post_admin_header_sx(ctx, slug, oob=oob, selected=selected)
|
||||
return await post_admin_header_sx(ctx, slug, oob=oob, selected=selected)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -190,24 +190,25 @@ async def render_orders_page(ctx: dict, orders: list, page: int,
|
||||
detail_url_prefix = pfx + url_for_fn("orders.order.order_detail", order_id=0).rsplit("0/", 1)[0]
|
||||
|
||||
order_dicts = [_serialize_order(o) for o in orders]
|
||||
content = sx_call("orders-list-content",
|
||||
orders=SxExpr(serialize(order_dicts)),
|
||||
content = await render_to_sx("orders-list-content",
|
||||
orders=order_dicts,
|
||||
page=page, total_pages=total_pages,
|
||||
rows_url=rows_url, detail_url_prefix=detail_url_prefix)
|
||||
|
||||
hdr = root_header_sx(ctx)
|
||||
auth = _auth_header_sx(ctx)
|
||||
orders_hdr = _orders_header_sx(ctx, list_url)
|
||||
auth_child = sx_call(
|
||||
hdr = await root_header_sx(ctx)
|
||||
auth = await _auth_header_sx(ctx)
|
||||
orders_hdr = await _orders_header_sx(ctx, list_url)
|
||||
auth_child_inner = await render_to_sx("header-child-sx", id="auth-header-child", inner=SxExpr(orders_hdr))
|
||||
auth_child = await render_to_sx(
|
||||
"header-child-sx",
|
||||
inner=SxExpr("(<> " + auth + " " + sx_call("header-child-sx", id="auth-header-child", inner=SxExpr(orders_hdr)) + ")"),
|
||||
inner=SxExpr("(<> " + auth + " " + auth_child_inner + ")"),
|
||||
)
|
||||
header_rows = "(<> " + hdr + " " + auth_child + ")"
|
||||
|
||||
filt = sx_call("order-list-header", search_mobile=SxExpr(search_mobile_sx(ctx)))
|
||||
return full_page_sx(ctx, header_rows=header_rows,
|
||||
filt = await render_to_sx("order-list-header", search_mobile=SxExpr(await search_mobile_sx(ctx)))
|
||||
return await full_page_sx(ctx, header_rows=header_rows,
|
||||
filter=filt,
|
||||
aside=search_desktop_sx(ctx),
|
||||
aside=await search_desktop_sx(ctx),
|
||||
content=content)
|
||||
|
||||
|
||||
@@ -222,20 +223,21 @@ async def render_orders_rows(ctx: dict, orders: list, page: int,
|
||||
detail_url_prefix = pfx + url_for_fn("orders.order.order_detail", order_id=0).rsplit("0/", 1)[0]
|
||||
|
||||
order_dicts = [_serialize_order(o) for o in orders]
|
||||
parts = [sx_call("order-row-pair",
|
||||
order=SxExpr(serialize(od)),
|
||||
detail_url_prefix=detail_url_prefix)
|
||||
for od in order_dicts]
|
||||
parts = []
|
||||
for od in order_dicts:
|
||||
parts.append(await render_to_sx("order-row-pair",
|
||||
order=od,
|
||||
detail_url_prefix=detail_url_prefix))
|
||||
|
||||
if page < total_pages:
|
||||
next_url = list_url + qs_fn(page=page + 1)
|
||||
parts.append(sx_call(
|
||||
parts.append(await render_to_sx(
|
||||
"infinite-scroll",
|
||||
url=next_url, page=page, total_pages=total_pages,
|
||||
id_prefix="orders", colspan=5,
|
||||
))
|
||||
else:
|
||||
parts.append(sx_call("order-end-row"))
|
||||
parts.append(await render_to_sx("order-end-row"))
|
||||
|
||||
return "(<> " + " ".join(parts) + ")"
|
||||
|
||||
@@ -255,24 +257,25 @@ async def render_orders_oob(ctx: dict, orders: list, page: int,
|
||||
detail_url_prefix = pfx + url_for_fn("orders.order.order_detail", order_id=0).rsplit("0/", 1)[0]
|
||||
|
||||
order_dicts = [_serialize_order(o) for o in orders]
|
||||
content = sx_call("orders-list-content",
|
||||
orders=SxExpr(serialize(order_dicts)),
|
||||
content = await render_to_sx("orders-list-content",
|
||||
orders=order_dicts,
|
||||
page=page, total_pages=total_pages,
|
||||
rows_url=rows_url, detail_url_prefix=detail_url_prefix)
|
||||
|
||||
auth_oob = _auth_header_sx(ctx, oob=True)
|
||||
auth_child_oob = sx_call(
|
||||
auth_oob = await _auth_header_sx(ctx, oob=True)
|
||||
orders_hdr = await _orders_header_sx(ctx, list_url)
|
||||
auth_child_oob = await render_to_sx(
|
||||
"oob-header-sx",
|
||||
parent_id="auth-header-child",
|
||||
row=SxExpr(_orders_header_sx(ctx, list_url)),
|
||||
row=SxExpr(orders_hdr),
|
||||
)
|
||||
root_oob = root_header_sx(ctx, oob=True)
|
||||
root_oob = await root_header_sx(ctx, oob=True)
|
||||
oobs = "(<> " + auth_oob + " " + auth_child_oob + " " + root_oob + ")"
|
||||
|
||||
filt = sx_call("order-list-header", search_mobile=SxExpr(search_mobile_sx(ctx)))
|
||||
return oob_page_sx(oobs=oobs,
|
||||
filt = await render_to_sx("order-list-header", search_mobile=SxExpr(await search_mobile_sx(ctx)))
|
||||
return await oob_page_sx(oobs=oobs,
|
||||
filter=filt,
|
||||
aside=search_desktop_sx(ctx),
|
||||
aside=await search_desktop_sx(ctx),
|
||||
content=content)
|
||||
|
||||
|
||||
@@ -296,29 +299,32 @@ async def render_order_page(ctx: dict, order: Any,
|
||||
order_data = _serialize_order(order)
|
||||
cal_data = [_serialize_calendar_entry(e) for e in (calendar_entries or [])]
|
||||
|
||||
main = sx_call("order-detail-content",
|
||||
order=SxExpr(serialize(order_data)),
|
||||
calendar_entries=SxExpr(serialize(cal_data)))
|
||||
filt = sx_call("order-detail-filter-content",
|
||||
order=SxExpr(serialize(order_data)),
|
||||
main = await render_to_sx("order-detail-content",
|
||||
order=order_data,
|
||||
calendar_entries=cal_data)
|
||||
filt = await render_to_sx("order-detail-filter-content",
|
||||
order=order_data,
|
||||
list_url=list_url, recheck_url=recheck_url,
|
||||
pay_url=pay_url, csrf=generate_csrf_token())
|
||||
|
||||
hdr = root_header_sx(ctx)
|
||||
order_row = sx_call(
|
||||
hdr = await root_header_sx(ctx)
|
||||
order_row = await render_to_sx(
|
||||
"menu-row-sx",
|
||||
id="order-row", level=3, colour="sky",
|
||||
link_href=detail_url, link_label=f"Order {order.id}", icon="fa fa-gbp",
|
||||
)
|
||||
order_child = sx_call(
|
||||
auth = await _auth_header_sx(ctx)
|
||||
orders_hdr = await _orders_header_sx(ctx, list_url)
|
||||
orders_child = await render_to_sx("header-child-sx", id="orders-header-child", inner=SxExpr(order_row))
|
||||
auth_inner = "(<> " + orders_hdr + " " + orders_child + ")"
|
||||
auth_child = await render_to_sx("header-child-sx", id="auth-header-child", inner=SxExpr(auth_inner))
|
||||
order_child = await render_to_sx(
|
||||
"header-child-sx",
|
||||
inner=SxExpr("(<> " + _auth_header_sx(ctx) + " " + sx_call("header-child-sx", id="auth-header-child", inner=SxExpr(
|
||||
"(<> " + _orders_header_sx(ctx, list_url) + " " + sx_call("header-child-sx", id="orders-header-child", inner=SxExpr(order_row)) + ")"
|
||||
)) + ")"),
|
||||
inner=SxExpr("(<> " + auth + " " + auth_child + ")"),
|
||||
)
|
||||
header_rows = "(<> " + hdr + " " + order_child + ")"
|
||||
|
||||
return full_page_sx(ctx, header_rows=header_rows, filter=filt, content=main)
|
||||
return await full_page_sx(ctx, header_rows=header_rows, filter=filt, content=main)
|
||||
|
||||
|
||||
async def render_order_oob(ctx: dict, order: Any,
|
||||
@@ -337,27 +343,27 @@ async def render_order_oob(ctx: dict, order: Any,
|
||||
order_data = _serialize_order(order)
|
||||
cal_data = [_serialize_calendar_entry(e) for e in (calendar_entries or [])]
|
||||
|
||||
main = sx_call("order-detail-content",
|
||||
order=SxExpr(serialize(order_data)),
|
||||
calendar_entries=SxExpr(serialize(cal_data)))
|
||||
filt = sx_call("order-detail-filter-content",
|
||||
order=SxExpr(serialize(order_data)),
|
||||
main = await render_to_sx("order-detail-content",
|
||||
order=order_data,
|
||||
calendar_entries=cal_data)
|
||||
filt = await render_to_sx("order-detail-filter-content",
|
||||
order=order_data,
|
||||
list_url=list_url, recheck_url=recheck_url,
|
||||
pay_url=pay_url, csrf=generate_csrf_token())
|
||||
|
||||
order_row_oob = sx_call(
|
||||
order_row_oob = await render_to_sx(
|
||||
"menu-row-sx",
|
||||
id="order-row", level=3, colour="sky",
|
||||
link_href=detail_url, link_label=f"Order {order.id}", icon="fa fa-gbp",
|
||||
oob=True,
|
||||
)
|
||||
orders_child_oob = sx_call("oob-header-sx",
|
||||
orders_child_oob = await render_to_sx("oob-header-sx",
|
||||
parent_id="orders-header-child",
|
||||
row=SxExpr(order_row_oob))
|
||||
root_oob = root_header_sx(ctx, oob=True)
|
||||
root_oob = await root_header_sx(ctx, oob=True)
|
||||
oobs = "(<> " + orders_child_oob + " " + root_oob + ")"
|
||||
|
||||
return oob_page_sx(oobs=oobs, filter=filt, content=main)
|
||||
return await oob_page_sx(oobs=oobs, filter=filt, content=main)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -370,25 +376,25 @@ async def render_checkout_error_page(ctx: dict, error: str | None = None,
|
||||
err_msg = error or "Unexpected error while creating the hosted checkout session."
|
||||
order_sx = None
|
||||
if order:
|
||||
order_sx = sx_call("checkout-error-order-id", oid=f"#{order.id}")
|
||||
order_sx = await render_to_sx("checkout-error-order-id", oid=f"#{order.id}")
|
||||
back_url = cart_url("/")
|
||||
|
||||
hdr = root_header_sx(ctx)
|
||||
filt = sx_call("checkout-error-header")
|
||||
content = sx_call(
|
||||
hdr = await root_header_sx(ctx)
|
||||
filt = await render_to_sx("checkout-error-header")
|
||||
content = await render_to_sx(
|
||||
"checkout-error-content",
|
||||
msg=err_msg,
|
||||
order=SxExpr(order_sx) if order_sx else None,
|
||||
back_url=back_url,
|
||||
)
|
||||
return full_page_sx(ctx, header_rows=hdr, filter=filt, content=content)
|
||||
return await full_page_sx(ctx, header_rows=hdr, filter=filt, content=content)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Public API: POST response renderers
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def render_cart_payments_panel(ctx: dict) -> str:
|
||||
async def render_cart_payments_panel(ctx: dict) -> str:
|
||||
"""Render the payments config panel for PUT response."""
|
||||
page_config = ctx.get("page_config")
|
||||
pc_data = None
|
||||
@@ -398,5 +404,5 @@ def render_cart_payments_panel(ctx: dict) -> str:
|
||||
"sumup_merchant_code": getattr(page_config, "sumup_merchant_code", None) or "",
|
||||
"sumup_checkout_prefix": getattr(page_config, "sumup_checkout_prefix", None) or "",
|
||||
}
|
||||
return sx_call("cart-payments-content",
|
||||
page_config=SxExpr(serialize(pc_data)) if pc_data else None)
|
||||
return await render_to_sx("cart-payments-content",
|
||||
page_config=pc_data)
|
||||
|
||||
@@ -27,31 +27,35 @@ def _register_cart_layouts() -> None:
|
||||
register_custom_layout("cart-admin", _cart_admin_full, _cart_admin_oob)
|
||||
|
||||
|
||||
def _cart_page_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import root_header_sx, sx_call, SxExpr
|
||||
async def _cart_page_full(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import root_header_sx, render_to_sx
|
||||
from shared.sx.parser import SxExpr
|
||||
from sx.sx_components import _cart_header_sx, _page_cart_header_sx
|
||||
|
||||
page_post = ctx.get("page_post")
|
||||
root_hdr = root_header_sx(ctx)
|
||||
child = _cart_header_sx(ctx)
|
||||
page_hdr = _page_cart_header_sx(ctx, page_post)
|
||||
nested = sx_call(
|
||||
root_hdr = await root_header_sx(ctx)
|
||||
child = await _cart_header_sx(ctx)
|
||||
page_hdr = await _page_cart_header_sx(ctx, page_post)
|
||||
inner_child = await render_to_sx("header-child-sx", id="cart-header-child", inner=SxExpr(page_hdr))
|
||||
nested = await render_to_sx(
|
||||
"header-child-sx",
|
||||
inner=SxExpr("(<> " + child + " " + sx_call("header-child-sx", id="cart-header-child", inner=SxExpr(page_hdr)) + ")"),
|
||||
inner=SxExpr("(<> " + child + " " + inner_child + ")"),
|
||||
)
|
||||
return "(<> " + root_hdr + " " + nested + ")"
|
||||
|
||||
|
||||
def _cart_page_oob(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import root_header_sx, sx_call, SxExpr
|
||||
async def _cart_page_oob(ctx: dict, **kw: Any) -> str:
|
||||
from shared.sx.helpers import root_header_sx, render_to_sx
|
||||
from shared.sx.parser import SxExpr
|
||||
from sx.sx_components import _cart_header_sx, _page_cart_header_sx
|
||||
|
||||
page_post = ctx.get("page_post")
|
||||
child_oob = sx_call("oob-header-sx",
|
||||
page_hdr = await _page_cart_header_sx(ctx, page_post)
|
||||
child_oob = await render_to_sx("oob-header-sx",
|
||||
parent_id="cart-header-child",
|
||||
row=SxExpr(_page_cart_header_sx(ctx, page_post)))
|
||||
cart_hdr_oob = _cart_header_sx(ctx, oob=True)
|
||||
root_hdr_oob = root_header_sx(ctx, oob=True)
|
||||
row=SxExpr(page_hdr))
|
||||
cart_hdr_oob = await _cart_header_sx(ctx, oob=True)
|
||||
root_hdr_oob = await root_header_sx(ctx, oob=True)
|
||||
return "(<> " + child_oob + " " + cart_hdr_oob + " " + root_hdr_oob + ")"
|
||||
|
||||
|
||||
@@ -61,9 +65,9 @@ async def _cart_admin_full(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
page_post = ctx.get("page_post")
|
||||
selected = kw.get("selected", "")
|
||||
root_hdr = root_header_sx(ctx)
|
||||
root_hdr = await root_header_sx(ctx)
|
||||
post_hdr = await _post_header_sx(ctx, page_post)
|
||||
admin_hdr = _cart_page_admin_header_sx(ctx, page_post, selected=selected)
|
||||
admin_hdr = await _cart_page_admin_header_sx(ctx, page_post, selected=selected)
|
||||
return "(<> " + root_hdr + " " + post_hdr + " " + admin_hdr + ")"
|
||||
|
||||
|
||||
@@ -72,7 +76,7 @@ async def _cart_admin_oob(ctx: dict, **kw: Any) -> str:
|
||||
|
||||
page_post = ctx.get("page_post")
|
||||
selected = kw.get("selected", "")
|
||||
return _cart_page_admin_header_sx(ctx, page_post, oob=True, selected=selected)
|
||||
return await _cart_page_admin_header_sx(ctx, page_post, oob=True, selected=selected)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -244,22 +248,21 @@ def _build_summary_data(ctx: dict, cart: list, cal_entries: list, tickets: list,
|
||||
|
||||
async def _h_overview_content(**kw):
|
||||
from quart import g
|
||||
from shared.sx.helpers import sx_call, SxExpr
|
||||
from shared.sx.parser import serialize
|
||||
from shared.sx.helpers import render_to_sx
|
||||
from shared.infrastructure.urls import cart_url
|
||||
from bp.cart.services import get_cart_grouped_by_page
|
||||
|
||||
page_groups = await get_cart_grouped_by_page(g.s)
|
||||
grp_dicts = [d for d in (_serialize_page_group(grp) for grp in page_groups) if d]
|
||||
return sx_call("cart-overview-content",
|
||||
page_groups=SxExpr(serialize(grp_dicts)),
|
||||
return await render_to_sx("cart-overview-content",
|
||||
page_groups=grp_dicts,
|
||||
cart_url_base=cart_url(""))
|
||||
|
||||
|
||||
async def _h_page_cart_content(page_slug=None, **kw):
|
||||
from quart import g
|
||||
from shared.sx.helpers import sx_call, SxExpr
|
||||
from shared.sx.parser import serialize
|
||||
from shared.sx.helpers import render_to_sx
|
||||
from shared.sx.parser import SxExpr
|
||||
from shared.sx.page import get_template_context
|
||||
from bp.cart.services import total, calendar_total, ticket_total
|
||||
from bp.cart.services.page_cart import (
|
||||
@@ -277,7 +280,7 @@ async def _h_page_cart_content(page_slug=None, **kw):
|
||||
sd = _build_summary_data(ctx, cart, cal_entries, page_tickets,
|
||||
total, calendar_total, ticket_total)
|
||||
|
||||
summary_sx = sx_call("cart-summary-from-data",
|
||||
summary_sx = await render_to_sx("cart-summary-from-data",
|
||||
item_count=sd["item_count"],
|
||||
grand_total=sd["grand_total"],
|
||||
symbol=sd["symbol"],
|
||||
@@ -286,10 +289,10 @@ async def _h_page_cart_content(page_slug=None, **kw):
|
||||
login_href=sd.get("login_href"),
|
||||
user_email=sd.get("user_email"))
|
||||
|
||||
return sx_call("cart-page-cart-content",
|
||||
cart_items=SxExpr(serialize([_serialize_cart_item(i) for i in cart])),
|
||||
cal_entries=SxExpr(serialize([_serialize_cal_entry(e) for e in cal_entries])),
|
||||
ticket_groups=SxExpr(serialize([_serialize_ticket_group(tg) for tg in ticket_groups])),
|
||||
return await render_to_sx("cart-page-cart-content",
|
||||
cart_items=[_serialize_cart_item(i) for i in cart],
|
||||
cal_entries=[_serialize_cal_entry(e) for e in cal_entries],
|
||||
ticket_groups=[_serialize_ticket_group(tg) for tg in ticket_groups],
|
||||
summary=SxExpr(summary_sx))
|
||||
|
||||
|
||||
@@ -299,8 +302,7 @@ async def _h_cart_admin_content(page_slug=None, **kw):
|
||||
|
||||
async def _h_cart_payments_content(page_slug=None, **kw):
|
||||
from shared.sx.page import get_template_context
|
||||
from shared.sx.helpers import sx_call, SxExpr
|
||||
from shared.sx.parser import serialize
|
||||
from shared.sx.helpers import render_to_sx
|
||||
|
||||
ctx = await get_template_context()
|
||||
page_config = ctx.get("page_config")
|
||||
@@ -311,5 +313,5 @@ async def _h_cart_payments_content(page_slug=None, **kw):
|
||||
"sumup_merchant_code": getattr(page_config, "sumup_merchant_code", None) or "",
|
||||
"sumup_checkout_prefix": getattr(page_config, "sumup_checkout_prefix", None) or "",
|
||||
}
|
||||
return sx_call("cart-payments-content",
|
||||
page_config=SxExpr(serialize(pc_data)) if pc_data else None)
|
||||
return await render_to_sx("cart-payments-content",
|
||||
page_config=pc_data)
|
||||
|
||||
Reference in New Issue
Block a user