From fb8f115acb6996b1bc266dc47ae2a4fdeb4d73f5 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 4 Mar 2026 01:55:32 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20orders=20defpage:=20length=E2=86=92len=20?= =?UTF-8?q?primitive,=20handle=20=5FRawHTML=20in=20serialize()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix undefined symbol 'length' → use 'len' primitive in orders.sx - Add _RawHTML handling in serialize() — wraps as (raw! "...") for SX wire format instead of falling through to repr() which produced unparseable symbol names Co-Authored-By: Claude Opus 4.6 --- orders/sxc/pages/orders.sx | 2 +- shared/sx/parser.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/orders/sxc/pages/orders.sx b/orders/sxc/pages/orders.sx index f9851c1..8c5bec6 100644 --- a/orders/sxc/pages/orders.sx +++ b/orders/sxc/pages/orders.sx @@ -28,7 +28,7 @@ :search-headers-desktop "{\"X-Origin\":\"search-desktop\",\"X-Search\":\"true\"}") :content (let* ((pfx (route-prefix)) (detail-url-raw (str pfx (url-for "defpage_order_detail" :order-id 0))) - (detail-prefix (slice detail-url-raw 0 (- (length detail-url-raw) 2))) + (detail-prefix (slice detail-url-raw 0 (- (len detail-url-raw) 2))) (rows-url (str pfx (url-for "orders.orders_rows")))) (~orders-list-content :orders orders diff --git a/shared/sx/parser.py b/shared/sx/parser.py index 3d085cf..d5ed399 100644 --- a/shared/sx/parser.py +++ b/shared/sx/parser.py @@ -336,6 +336,17 @@ def serialize(expr: Any, indent: int = 0, pretty: bool = False) -> str: items.append(serialize(v, indent, pretty)) return "{" + " ".join(items) + "}" + # _RawHTML — pre-rendered HTML; wrap as (raw! "...") for SX wire format + from .html import _RawHTML + if isinstance(expr, _RawHTML): + escaped = ( + expr.html.replace("\\", "\\\\") + .replace('"', '\\"') + .replace("\n", "\\n") + .replace("