Merge branch 'worktree-iso-phase-4' into macros
This commit is contained in:
@@ -507,7 +507,7 @@ def mount_pages(bp: Any, service_name: str,
|
|||||||
|
|
||||||
def _mount_one_page(bp: Any, service_name: str, page_def: PageDef) -> None:
|
def _mount_one_page(bp: Any, service_name: str, page_def: PageDef) -> None:
|
||||||
"""Mount a single PageDef as a GET route on the blueprint."""
|
"""Mount a single PageDef as a GET route on the blueprint."""
|
||||||
from quart import make_response, Response
|
from quart import make_response, Response, stream_with_context
|
||||||
|
|
||||||
if page_def.stream:
|
if page_def.stream:
|
||||||
# Streaming response: yields HTML chunks as IO resolves
|
# Streaming response: yields HTML chunks as IO resolves
|
||||||
@@ -520,9 +520,10 @@ def _mount_one_page(bp: Any, service_name: str, page_def: PageDef) -> None:
|
|||||||
if hasattr(result, "status_code"):
|
if hasattr(result, "status_code"):
|
||||||
return result
|
return result
|
||||||
return await make_response(result, 200)
|
return await make_response(result, 200)
|
||||||
# Streaming response
|
# Streaming response — stream_with_context preserves app/request
|
||||||
|
# context across async generator yields
|
||||||
gen = execute_page_streaming(current, service_name, url_params=kwargs)
|
gen = execute_page_streaming(current, service_name, url_params=kwargs)
|
||||||
return Response(gen, content_type="text/html; charset=utf-8")
|
return Response(stream_with_context(gen), content_type="text/html; charset=utf-8")
|
||||||
else:
|
else:
|
||||||
# Standard non-streaming response
|
# Standard non-streaming response
|
||||||
async def page_view(**kwargs: Any) -> Any:
|
async def page_view(**kwargs: Any) -> Any:
|
||||||
|
|||||||
Reference in New Issue
Block a user