Classes
LayoutSnapshotDict
3
▼
Layout info in a render plan debug snapshot.
LayoutSnapshotDict
3
▼
Layout info in a render plan debug snapshot.
Attributes
| Name | Type | Description |
|---|---|---|
template_name |
str
|
— |
target |
str
|
— |
depth |
int
|
— |
MainViewSnapshotDict
4
▼
Main view info in a render plan debug snapshot.
MainViewSnapshotDict
4
▼
Main view info in a render plan debug snapshot.
Attributes
| Name | Type | Description |
|---|---|---|
template |
str
|
— |
block |
str | None
|
— |
context_keys |
list[str]
|
— |
context_preview |
list[tuple[str, str]]
|
— |
RegionUpdateDict
4
▼
Region update info in a render plan debug snapshot.
RegionUpdateDict
4
▼
Region update info in a render plan debug snapshot.
Attributes
| Name | Type | Description |
|---|---|---|
region |
str
|
— |
template |
str
|
— |
block |
str | None
|
— |
mode |
str
|
— |
RenderPlanSnapshotDict
10
▼
Full serialized render plan for debug display.
RenderPlanSnapshotDict
10
▼
Full serialized render plan for debug display.
Attributes
| Name | Type | Description |
|---|---|---|
intent |
str
|
— |
render_full_template |
bool
|
— |
apply_layouts |
bool
|
— |
layout_start_index |
int
|
— |
include_layout_oob |
bool
|
— |
main_view |
MainViewSnapshotDict
|
— |
layout_chain |
list[LayoutSnapshotDict]
|
— |
layouts_applied |
list[str]
|
— |
layout_context_preview |
list[tuple[str, str]]
|
— |
region_updates |
list[RegionUpdateDict]
|
— |
Functions
summarize_context_for_debug
1
list[tuple[str, str]]
▼
Return (key, repr preview) pairs for debug display.
summarize_context_for_debug
1
list[tuple[str, str]]
▼
def summarize_context_for_debug(ctx: dict[str, Any]) -> list[tuple[str, str]]
Parameters
| Name | Type | Description |
|---|---|---|
ctx |
dict[str, Any] |
Returns
list[tuple[str, str]]
serialize_render_plan_for_debug
1
RenderPlanSnapshotDict
▼
Build a snapshot dict for the debug error page.
serialize_render_plan_for_debug
1
RenderPlanSnapshotDict
▼
def serialize_render_plan_for_debug(plan: RenderPlan) -> RenderPlanSnapshotDict
Parameters
| Name | Type | Description |
|---|---|---|
plan |
RenderPlan |
Returns
RenderPlanSnapshotDict
stash_render_debug_for_request
3
None
▼
Store render plan on the request for middleware and debug tools.
The frozen ``…
stash_render_debug_for_request
3
None
▼
def stash_render_debug_for_request(plan: RenderPlan, request: Request | None, *, debug: bool = False) -> None
Store render plan on the request for middleware and debug tools.
The frozenRenderPlanobject is always stashed (zero overhead —
it is already immutable). The heavier serialized debug snapshot is
only built when debug is True.
Parameters
| Name | Type | Description |
|---|---|---|
plan |
RenderPlan |
|
request |
Request | None |
|
debug |
bool |
Default:False
|
get_render_plan
1
RenderPlan | None
▼
Return the frozen ``RenderPlan`` used to render this request.
Available after …
get_render_plan
1
RenderPlan | None
▼
def get_render_plan(request: Any) -> RenderPlan | None
Return the frozenRenderPlanused to render this request.
Available after content negotiation has run forPage,
LayoutPage, or PageCompositionreturn types. Returns
Nonefor non-page responses or if negotiation has not yet run.
Use in middleware to inspect rendering decisions::
plan = get_render_plan(request)
if plan is not None:
print(plan.intent) # "full_page", "page_fragment", "local_fragment"
Parameters
| Name | Type | Description |
|---|---|---|
request |
Any |
Returns
RenderPlan | None
read_render_debug_from_request
1
RenderPlanSnapshotDict |…
▼
Return stashed snapshot if present (request may be a test double).
read_render_debug_from_request
1
RenderPlanSnapshotDict |…
▼
def read_render_debug_from_request(request: Any) -> RenderPlanSnapshotDict | None
Parameters
| Name | Type | Description |
|---|---|---|
request |
Any |
Returns
RenderPlanSnapshotDict | None