ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

module documentation

Provide session operations.

Includes filter_input, normalize_errors, queue_bag, apply_flash.

Class _FlashData Queue flash payloads for responses and deferred views.
Function _normalize_message Extract a structured message or stringify a scalar value.
Function apply_flash Write a pending flash payload into the session.
Function filter_input Drop credential-like fields from a form payload before flashing it.
Function normalize_errors Normalize validation errors into field-indexed message lists.
Function queue_bag Merge values into the reserved bag key of a pending flash payload.
Constant _SEQUENCE_TYPES Hoisted so the isinstance check does not rebuild the tuple on every field.
Constant ERRORS_KEY Session key containing flashed validation errors.
Constant OLD_INPUT_KEY Reserved flash-bag keys owned by the framework. Application code must never write them directly; use withInput() / withErrors() instead.
Constant PREVIOUS_URL_KEY Reserved session key holding the last page the user navigated to.
Constant SENSITIVE_INPUT_FIELDS Never carried over when repopulating a form.
def _normalize_message(value: object) -> str: (source)

Extract a structured message or stringify a scalar value.

Parameters
value:objectMessage value or mapping containing a message entry.
Returns
strText representation without a structured rule code.
def apply_flash(session: ISession, data: Mapping[str, Any]): (source)

Write a pending flash payload into the session.

Reserved bags are routed through their dedicated session methods so they merge with anything already flashed during this request instead of replacing it.

Parameters
session:orionis.session.contracts.ISessionSession receiving the flashed values.
data:collections.abc.Mapping[str, typing.Any]Pending flash payload.
Returns
NoneNo return value.
def filter_input(values: Mapping[str, Any]) -> dict[str, Any]: (source)

Drop credential-like fields from a form payload before flashing it.

Parameters
values:collections.abc.Mapping[str, typing.Any]Raw submitted payload.
Returns
dict[str, typing.Any]Copy of values without any field listed in orionis.session.flash.SENSITIVE_INPUT_FIELDS.
def normalize_errors(errors: object) -> dict[str, list[str]]: (source)

Normalize validation errors into field-indexed message lists.

Parameters
errors:objectMapping of messages or {rule, message} details, or an exception exposing errors or failure.
Returns
dict[str, list[str]]String messages grouped by field, with structured rule codes omitted.
Raises
TypeErrorIf errors is neither a mapping nor a validation exception.
def queue_bag(flash: dict[str, Any], key: str, values: Mapping[str, Any]): (source)

Merge values into the reserved bag key of a pending flash payload.

Parameters
flash:dict[str, typing.Any]Pending flash payload owned by a response or a pending view.
key:strReserved bag key.
values:collections.abc.Mapping[str, typing.Any]Entries to merge into the bag.
Returns
NoneNo return value.
_SEQUENCE_TYPES: tuple[type, ...] = (source)

Hoisted so the isinstance check does not rebuild the tuple on every field.

Value
(list, tuple, set, frozenset)
ERRORS_KEY: str = (source)

Session key containing flashed validation errors.

Value
'_errors'
OLD_INPUT_KEY: str = (source)

Reserved flash-bag keys owned by the framework. Application code must never write them directly; use withInput() / withErrors() instead.

Value
'_old_input'
PREVIOUS_URL_KEY: str = (source)

Reserved session key holding the last page the user navigated to.

Value
'_previous_url'
SENSITIVE_INPUT_FIELDS: frozenset[str] = (source)

Never carried over when repopulating a form.

Value
frozenset(set(['_csrf',
               'csrf_token',
               'current_password',
               'new_password',
               'password',
               'password_confirmation']))