Make SxExpr a str subclass, sx_call/render functions return SxExpr
SxExpr is now a str subclass so it works everywhere a plain string does (join, isinstance, f-strings) while serialize() still emits it unquoted. sx_call() and all internal render functions (_render_to_sx, async_eval_to_sx, etc.) return SxExpr, eliminating the "forgot to wrap" bug class that caused the sx_content leak and list serialization bugs. - Phase 0: SxExpr(str) with .source property, __add__/__radd__ - Phase 1: sx_call returns SxExpr (drop-in, all 200+ sites unchanged) - Phase 2: async_eval_to_sx, async_eval_slot_to_sx, _render_to_sx, mobile_menu_sx return SxExpr; remove isinstance(str) workaround - Phase 3: Remove ~150 redundant SxExpr() wrappings across 45 files - Phase 4: serialize() docstring, handler return docs, ;; returns: sx Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -160,7 +160,7 @@ def _slot_header_html(ctx: dict, *, oob: bool = False) -> str:
|
||||
name=slot.name, description=desc)
|
||||
|
||||
return sx_call("menu-row-sx", id="slot-row", level=5,
|
||||
link_label_content=SxExpr(label_sx),
|
||||
link_label_content=label_sx,
|
||||
child_id="slot-header-child", oob=oob)
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ def render_slot_main_panel(slot, calendar, *, oob: bool = False) -> str:
|
||||
|
||||
result = sx_call("events-slot-panel",
|
||||
slot_id=sid, list_container=list_container,
|
||||
days=SxExpr(days_html),
|
||||
days=days_html,
|
||||
flexible="yes" if flexible else "no",
|
||||
time_str=f"{time_start} \u2014 {time_end}",
|
||||
cost_str=cost_str,
|
||||
@@ -259,7 +259,7 @@ def render_slots_table(slots, calendar) -> str:
|
||||
pill_cls=pill_cls, hx_select=hx_select,
|
||||
slot_name=s.name, description=desc,
|
||||
flexible="yes" if s.flexible else "no",
|
||||
days=SxExpr(days_html),
|
||||
days=days_html,
|
||||
time_str=f"{time_start} - {time_end}",
|
||||
cost_str=cost_str, action_btn=action_btn,
|
||||
del_url=del_url,
|
||||
|
||||
Reference in New Issue
Block a user