Use lazy import for quart.Response in sexp_response helper
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m4s
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:
@@ -9,7 +9,6 @@ from __future__ import annotations
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from markupsafe import escape
|
from markupsafe import escape
|
||||||
from quart import Response
|
|
||||||
|
|
||||||
from .jinja_bridge import render
|
from .jinja_bridge import render
|
||||||
from .page import SEARCH_HEADERS_MOBILE, SEARCH_HEADERS_DESKTOP
|
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,
|
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.
|
"""Return an s-expression wire-format response.
|
||||||
|
|
||||||
The client-side sexp.js will intercept responses with Content-Type
|
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")')
|
return sexp_response('(~test-row :nodeid "test_foo" :outcome "passed")')
|
||||||
"""
|
"""
|
||||||
|
from quart import Response
|
||||||
resp = Response(sexp_source, status=status, content_type="text/sexp")
|
resp = Response(sexp_source, status=status, content_type="text/sexp")
|
||||||
if headers:
|
if headers:
|
||||||
for k, v in headers.items():
|
for k, v in headers.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user