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__ Undocumented
Property dirty True if pending changes must be written to the backing store.
Property id Current session identifier, or None before the first write.
Property invalidated True when the session has been marked for full deletion.
Property isNew True for sessions not loaded from a backing store.
Property started True once the session has been activated by a write.
Property wantsRegenerate True when the session ID should be rotated before saving.
@abstractmethod
def all(self) -> dict[str, Any]: (source)

Return a shallow copy of the current session data.

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

Remove all data from this session.

Returns
NoneUndocumented
@abstractmethod
def flash(self, key: str, value: Any): (source)

Store value under key for exactly one subsequent request.

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

Flash validation errors for the next request.

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

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

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

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

Parameters
key:strSession data key to remove.
Returns
NoneUndocumented
@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:Any, optionalFallback value returned when key is not found.
Returns
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:Any, optionalFallback value when the key is absent from both bags.
Returns
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:Any, optionalFallback value when the field was not submitted.
Returns
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
NoneUndocumented
@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:AnyValue to store.
Returns
NoneUndocumented
@abstractmethod
def regenerate(self): (source)

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

Returns
NoneUndocumented
@abstractmethod
def setPreviousUrl(self, url: str): (source)

Remember the page the user is currently viewing.

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

Undocumented

@property
@abstractmethod
dirty: bool = (source)

True if pending changes must be written to the backing store.

Returns
boolResult of the operation described above.
@property
@abstractmethod
id: str | None = (source)

Current session identifier, or None before the first write.

Returns
str | NoneResult of the operation described above.
@property
@abstractmethod
invalidated: bool = (source)

True when the session has been marked for full deletion.

Returns
boolResult of the operation described above.
@property
@abstractmethod
isNew: bool = (source)

True for sessions not loaded from a backing store.

Returns
boolResult of the operation described above.
@property
@abstractmethod
started: bool = (source)

True once the session has been activated by a write.

Returns
boolResult of the operation described above.
@property
@abstractmethod
wantsRegenerate: bool = (source)

True when the session ID should be rotated before saving.

Returns
boolResult of the operation described above.