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 ISession(ABC): (source)

Known subclasses: orionis.session.session.Session

View In Hierarchy

Contract for a single HTTP session runtime object.

Implementors manage an in-memory key-value payload, flash data for one-request-lifetime values, and state flags consumed by the SessionManager (started, dirty, invalidated).

Notes

Implementors must never interact directly with Request, Response, or any ISessionStore. All I/O is the responsibility of the SessionManager.

Method all Return a shallow copy of the current session data.
Method clear Remove all data from this session.
Method flash Store value under key for exactly one subsequent request.
Method flashErrors Flash validation errors for the next request.
Method flashInput Flash a submitted form payload so the next request can repopulate it.
Method forget Remove key from session data (no-op when absent).
Method get Return the value for key, or default when absent.
Method getErrors Return the validation errors flashed for this request.
Method getFlash Return the flash value for key.
Method getOldInput Return the value submitted for key in the previous request.
Method getPreviousUrl Return the last page the user navigated to.
Method has Return True when key exists in the session data.
Method invalidate Mark the session for full deletion and clear in-memory data.
Method put Store value under key, activating the session on the first call.
Method regenerate Request a session ID rotation (e.g. immediately after login).
Method setPreviousUrl Remember the page the user is currently viewing.
Class Variable __slots__ Declare that this class introduces no additional instance slots.
Property dirty Report whether changes require persistence.
Property id Return the current session identifier.
Property invalidated Report whether the session has been invalidated.
Property isNew Report whether the session has a new storage identity.
Property started Report whether the session has been activated.
Property wantsRegenerate Report whether the session requests identifier rotation.
@abstractmethod
def all(self) -> dict[str, Any]: (source)

Return a shallow copy of the current session data.

Returns
dict[str, typing.Any]Copy of all session key-value pairs including internal flash bags.
@abstractmethod
def clear(self): (source)

Remove all data from this session.

Returns
NoneNo return value.
@abstractmethod
def flash(self, key: str, value: Any): (source)

Store value under key for exactly one subsequent request.

Parameters
key:strFlash data key.
value:typing.AnyFlash data value.
Returns
NoneNo return value.
@abstractmethod
def flashErrors(self, errors: Mapping[str, Any] | Exception): (source)

Flash validation errors for the next request.

Parameters
errors:collections.abc.Mapping[str, typing.Any] | ExceptionMapping of field to message(s), or a validation exception.
Returns
NoneNo return value.
@abstractmethod
def flashInput(self, values: Mapping[str, Any]): (source)

Flash a submitted form payload so the next request can repopulate it.

Parameters
values:collections.abc.Mapping[str, typing.Any]Submitted payload to remember. Credential-like fields are stripped before storing.
Returns
NoneNo return value.
@abstractmethod
def forget(self, key: str): (source)

Remove key from session data (no-op when absent).

Parameters
key:strSession data key to remove.
Returns
NoneNo return value.
@abstractmethod
def get(self, key: str, default: Any = None) -> Any: (source)

Return the value for key, or default when absent.

Parameters
key:strSession data key.
default:typing.Any, optionalFallback value returned when key is not found.
Returns
typing.AnyThe stored value, or default.
@abstractmethod
def getErrors(self) -> dict[str, list[str]]: (source)

Return the validation errors flashed for this request.

Returns
dict[str, list[str]]Field-indexed error messages, empty when none were flashed.
@abstractmethod
def getFlash(self, key: str, default: Any = None) -> Any: (source)

Return the flash value for key.

Values flashed during the current request take precedence over the ones inherited from the previous one.

Parameters
key:strFlash data key.
default:typing.Any, optionalFallback value when the key is absent from both bags.
Returns
typing.AnyThe flash value, or default.
@abstractmethod
def getOldInput(self, key: str, default: Any = None) -> Any: (source)

Return the value submitted for key in the previous request.

Parameters
key:strForm field name.
default:typing.Any, optionalFallback value when the field was not submitted.
Returns
typing.AnyThe previously submitted value, or default.
@abstractmethod
def getPreviousUrl(self, default: str | None = None) -> str | None: (source)

Return the last page the user navigated to.

Parameters
default:str | None, optionalFallback returned when no page has been recorded yet.
Returns
str | NoneThe stored URL, or default.
@abstractmethod
def has(self, key: str) -> bool: (source)

Return True when key exists in the session data.

Parameters
key:strSession data key.
Returns
boolTrue if the key is present.
@abstractmethod
def invalidate(self): (source)

Mark the session for full deletion and clear in-memory data.

Returns
NoneNo return value.
@abstractmethod
def put(self, key: str, value: Any): (source)

Store value under key, activating the session on the first call.

Parameters
key:strSession data key.
value:typing.AnyValue to store.
Returns
NoneNo return value.
@abstractmethod
def regenerate(self): (source)

Request a session ID rotation (e.g. immediately after login).

Returns
NoneNo return value.
@abstractmethod
def setPreviousUrl(self, url: str): (source)

Remember the page the user is currently viewing.

Parameters
url:strAbsolute URL of the current page.
Returns
NoneNo return value.
__slots__: tuple = (source)

Declare that this class introduces no additional instance slots.

@property
@abstractmethod
dirty: bool = (source)

Report whether changes require persistence.

Returns
boolTrue when tracked changes require a backing-store write.
@property
@abstractmethod
id: str | None = (source)

Return the current session identifier.

Returns
str | NoneIdentifier, or None before activation.
@property
@abstractmethod
invalidated: bool = (source)

Report whether the session has been invalidated.

Returns
boolTrue when the session is marked for full deletion.
@property
@abstractmethod
isNew: bool = (source)

Report whether the session has a new storage identity.

Returns
boolTrue until the current identifier has been persisted.
@property
@abstractmethod
started: bool = (source)

Report whether the session has been activated.

Returns
boolTrue after activation or restoration from a store.
@property
@abstractmethod
wantsRegenerate: bool = (source)

Report whether the session requests identifier rotation.

Returns
boolTrue when the identifier should be rotated before saving.