Use lazy import for quart.Response in sexp_response helper
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m4s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 23:46:58 +00:00
parent fec5ecdfb1
commit b92e7a763e

View File

@@ -9,7 +9,6 @@ from __future__ import annotations
from typing import Any
from markupsafe import escape
from quart import Response
from .jinja_bridge import render
from .page import SEARCH_HEADERS_MOBILE, SEARCH_HEADERS_DESKTOP
@@ -227,7 +226,7 @@ def full_page(ctx: dict, *, header_rows_html: str,
def sexp_response(sexp_source: str, status: int = 200,
headers: dict | None = None) -> Response:
headers: dict | None = None):
"""Return an s-expression wire-format response.
The client-side sexp.js will intercept responses with Content-Type
@@ -237,6 +236,7 @@ def sexp_response(sexp_source: str, status: int = 200,
return sexp_response('(~test-row :nodeid "test_foo" :outcome "passed")')
"""
from quart import Response
resp = Response(sexp_source, status=status, content_type="text/sexp")
if headers:
for k, v in headers.items():