Module

pages.shell_context

Shell context assembly from RouteMeta and section.

Builds page_title, breadcrumb_items, tab_items, current_path for layout templates. Only includes keys where source is non-None.

Functions

resolve_meta 4 RouteMeta | None
Resolve RouteMeta from static meta or meta_provider callable. Supports both sy…
async
async def resolve_meta(meta: RouteMeta | None, meta_provider: Any, path_params: dict[str, str], service_providers: dict[type, Any]) -> RouteMeta | None

Resolve RouteMeta from static meta or meta_provider callable.

Supports both sync and async meta() providers. Uses same arg resolution as _call_provider: path params, empty accumulated context, and service providers.

Parameters
Name Type Description
meta RouteMeta | None
meta_provider Any
path_params dict[str, str]
service_providers dict[type, Any]
Returns
RouteMeta | None
_dict_to_route_meta 1 RouteMeta
Convert a dict returned by a meta provider to RouteMeta.
def _dict_to_route_meta(d: dict[str, Any]) -> RouteMeta
Parameters
Name Type Description
d dict[str, Any]
Returns
RouteMeta
_call_meta_provider 4 Any
Call meta provider with path params, context, and services.
def _call_meta_provider(func: Any, path_params: dict[str, str], accumulated_ctx: dict[str, Any], service_providers: dict[type, Any]) -> Any
Parameters
Name Type Description
func Any
path_params dict[str, str]
accumulated_ctx dict[str, Any]
service_providers dict[type, Any]
Returns
Any
build_shell_context 4 dict[str, Any]
Build shell context from request, meta, and section. Produces: - current_p…
def build_shell_context(request: Request, meta: RouteMeta | None, section_ctx: dict[str, Any], cascade_ctx: dict[str, Any]) -> dict[str, Any]

Build shell context from request, meta, and section.

Produces:

  • current_path from request.path
  • page_title from meta.title
  • breadcrumb_items from section prefix + meta.breadcrumb_label
  • tab_items from section tab items

Only includes keys where source is non-None.

Parameters
Name Type Description
request Request
meta RouteMeta | None
section_ctx dict[str, Any]
cascade_ctx dict[str, Any]
Returns
dict[str, Any]