Fix feed error response rendering with to_xml

The 422 error handlers were using str() to convert FT objects to HTML,
which produces Python repr output instead of HTML. Changed to use
to_xml() like other routes (eggs.py, products.py) do.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-08 09:11:08 +00:00
parent 3f510d8d76
commit d4a29130f6

View File

@@ -6,7 +6,7 @@ from __future__ import annotations
import time import time
from typing import Any from typing import Any
from fasthtml.common import APIRouter, add_toast from fasthtml.common import APIRouter, add_toast, to_xml
from starlette.requests import Request from starlette.requests import Request
from starlette.responses import HTMLResponse from starlette.responses import HTMLResponse
@@ -437,7 +437,7 @@ def _render_give_error(
HTMLResponse with 422 status. HTMLResponse with 422 status.
""" """
return HTMLResponse( return HTMLResponse(
content=str( content=to_xml(
render_page( render_page(
request, request,
feed_page( feed_page(
@@ -471,7 +471,7 @@ def _render_purchase_error(request, locations, feed_types, error_message):
HTMLResponse with 422 status. HTMLResponse with 422 status.
""" """
return HTMLResponse( return HTMLResponse(
content=str( content=to_xml(
render_page( render_page(
request, request,
feed_page( feed_page(