Fix orders defpage: length→len primitive, handle _RawHTML in serialize()
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
:search-headers-desktop "{\"X-Origin\":\"search-desktop\",\"X-Search\":\"true\"}")
|
:search-headers-desktop "{\"X-Origin\":\"search-desktop\",\"X-Search\":\"true\"}")
|
||||||
:content (let* ((pfx (route-prefix))
|
:content (let* ((pfx (route-prefix))
|
||||||
(detail-url-raw (str pfx (url-for "defpage_order_detail" :order-id 0)))
|
(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"))))
|
(rows-url (str pfx (url-for "orders.orders_rows"))))
|
||||||
(~orders-list-content
|
(~orders-list-content
|
||||||
:orders orders
|
:orders orders
|
||||||
|
|||||||
@@ -336,6 +336,17 @@ def serialize(expr: Any, indent: int = 0, pretty: bool = False) -> str:
|
|||||||
items.append(serialize(v, indent, pretty))
|
items.append(serialize(v, indent, pretty))
|
||||||
return "{" + " ".join(items) + "}"
|
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("</script", "<\\/script")
|
||||||
|
)
|
||||||
|
return f'(raw! "{escaped}")'
|
||||||
|
|
||||||
# Catch callables (Python functions leaked into sx data)
|
# Catch callables (Python functions leaked into sx data)
|
||||||
if callable(expr):
|
if callable(expr):
|
||||||
import logging
|
import logging
|
||||||
|
|||||||
Reference in New Issue
Block a user