Replace sx_call() with render_to_sx() across all services
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:
@@ -14,10 +14,9 @@ from typing import Any
|
||||
from markupsafe import escape
|
||||
|
||||
from shared.sx.helpers import (
|
||||
sx_call, root_header_sx, oob_header_sx,
|
||||
root_header_sx, oob_header_sx,
|
||||
mobile_menu_sx, mobile_root_nav_sx, full_page_sx, oob_page_sx,
|
||||
)
|
||||
from shared.sx.parser import SxExpr
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -91,23 +90,23 @@ def _social_header_row(actor: Any) -> str:
|
||||
)
|
||||
|
||||
|
||||
def _social_full_headers(ctx: dict, **kw: Any) -> str:
|
||||
root_hdr = root_header_sx(ctx)
|
||||
async def _social_full_headers(ctx: dict, **kw: Any) -> str:
|
||||
root_hdr = await root_header_sx(ctx)
|
||||
actor = kw.get("actor")
|
||||
social_row = _social_header_row(actor)
|
||||
return "(<> " + root_hdr + " " + social_row + ")"
|
||||
|
||||
|
||||
def _social_oob_headers(ctx: dict, **kw: Any) -> str:
|
||||
root_hdr = root_header_sx(ctx)
|
||||
async def _social_oob_headers(ctx: dict, **kw: Any) -> str:
|
||||
root_hdr = await root_header_sx(ctx)
|
||||
actor = kw.get("actor")
|
||||
social_row = _social_header_row(actor)
|
||||
rows = "(<> " + root_hdr + " " + social_row + ")"
|
||||
return oob_header_sx("root-header-child", "social-lite-header-child", rows)
|
||||
return await oob_header_sx("root-header-child", "social-lite-header-child", rows)
|
||||
|
||||
|
||||
def _social_mobile(ctx: dict, **kw: Any) -> str:
|
||||
return mobile_menu_sx(mobile_root_nav_sx(ctx))
|
||||
async def _social_mobile(ctx: dict, **kw: Any) -> str:
|
||||
return mobile_menu_sx(await mobile_root_nav_sx(ctx))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user