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.

class documentation

class ErrorBag: (source)

Constructor: ErrorBag(app)

View In Hierarchy

Expose validation errors from the current request session.

Exposed to templates as the errors global. Every method is a coroutine, which Jinja2 awaits transparently in async environments:

{% if errors.any() %}{{ errors.first('email') }}{% endif %}
Method __init__ Bind the bag to the application container.
Async Method __resolve Return the flashed error mapping, or an empty mapping.
Async Method all Return every error grouped by field.
Async Method any Report whether at least one field failed validation.
Async Method first Return the first message for field, or the first of any field.
Async Method get Return every message recorded for field.
Async Method has Report whether field has at least one error.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _app Application container used for service resolution.
def __init__(self, app: IApplication): (source)

Bind the bag to the application container.

Parameters
app:orionis.IApplicationApplication container used for service resolution.
Returns
NoneNo return value.
async def __resolve(self) -> dict[str, list[str]]: (source)

Return the flashed error mapping, or an empty mapping.

Returns
dict[str, list[str]]Field-indexed error messages.
async def all(self) -> dict[str, list[str]]: (source)

Return every error grouped by field.

Returns
dict[str, list[str]]Existing session mapping, or a new empty mapping without a session.
async def any(self) -> bool: (source)

Report whether at least one field failed validation.

Returns
boolTrue when the bag holds any message.
async def first(self, field: str | None = None) -> str: (source)

Return the first message for field, or the first of any field.

Parameters
field:str | None, optionalForm field name. When omitted, the first message of the whole bag is returned, which suits a single summary line.
Returns
strThe message, or an empty string when there is none.
async def get(self, field: str) -> list[str]: (source)

Return every message recorded for field.

Parameters
field:strForm field name.
Returns
list[str]Messages for the field, empty when it is valid.
async def has(self, field: str) -> bool: (source)

Report whether field has at least one error.

Parameters
field:strForm field name.
Returns
boolTrue when the field failed validation.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

Application container used for service resolution.