Module

pages.actions

Action discovery and dispatch for _actions.py.

Discovers @action decorated functions and dispatches by _action form field.

Functions

action 1 Callable[[Callable[..., …
Decorator to register a named action in _actions.py. The action name is used a…
def action(name: str) -> Callable[[Callable[..., Any]], Callable[..., Any]]

Decorator to register a named action in _actions.py.

The action name is used as the value for the _action form field.

Parameters
Name Type Description
name str
Returns
Callable[[Callable[..., Any]], Callable[..., Any]]
load_actions 1 tuple[ActionInfo, ...]
Load ActionInfo from a module with @action decorated functions.
def load_actions(actions_module: Any) -> tuple[ActionInfo, ...]
Parameters
Name Type Description
actions_module Any
Returns
tuple[ActionInfo, ...]
dispatch_action 5 Any
Invoke an action with path params, context, and services. Resolves handler kwa…
async
async def dispatch_action(action_info: ActionInfo, path_params: dict[str, str], cascade_ctx: dict[str, Any], service_providers: dict[type, Any], form_data: dict[str, Any] | None = None) -> Any

Invoke an action with path params, context, and services.

Resolves handler kwargs same as context providers. Returns the action's return value (may be Redirect, Fragment, OOB, etc.).

Parameters
Name Type Description
action_info ActionInfo
path_params dict[str, str]
cascade_ctx dict[str, Any]
service_providers dict[type, Any]
form_data dict[str, Any] | None Default:None
Returns
Any
_resolve_action_kwargs 5 dict[str, Any]
Resolve kwargs for action function (same pattern as _call_provider).
def _resolve_action_kwargs(func: Any, path_params: dict[str, str], cascade_ctx: dict[str, Any], service_providers: dict[type, Any], form_data: dict[str, Any]) -> dict[str, Any]
Parameters
Name Type Description
func Any
path_params dict[str, str]
cascade_ctx dict[str, Any]
service_providers dict[type, Any]
form_data dict[str, Any]
Returns
dict[str, Any]