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

Configure the session middleware.

Returns
NoneThis class does not return a value.
Method __post_init__ Validate all fields after dataclass initialisation.
Method __validateBooleans Validate all boolean fields in a single pass.
Method __validateCache Validate the cache field.
Method __validateConnection Validate the connection field.
Method __validateCookie Validate the cookie field.
Method __validateDomain Validate the domain field.
Method __validateDriver Normalise and validate the driver field.
Method __validateFiles Validate the files path field.
Method __validateLifetime Validate the lifetime field.
Method __validatePath Validate the path field.
Method __validateSameSite Normalise and validate the same_site field.
Method __validateTable Validate the table field.
Instance Variable cache Cache store for session storage (cache driver). Defaults to None.
Instance Variable connection Database connection for session storage (database driver). Defaults to None.
Instance Variable cookie Name of the session cookie. Defaults to 'sessionid'.
Instance Variable domain Cookie domain for cross-subdomain usage.
Instance Variable driver Session driver. Defaults to SessionDriver.MEMORY.
Instance Variable expire_on_close Expire session on browser close (omits Max-Age). Defaults to False.
Instance Variable files Path to session files (file driver). Defaults to 'storage/framework/sessions'.
Instance Variable http_only Prevent JavaScript from accessing the cookie. Defaults to True.
Instance Variable lifetime Session lifetime in minutes. Defaults to 120.
Instance Variable partitioned Enable CHIPS (partitioned) cookies. Defaults to False.
Instance Variable path Cookie path. Defaults to '/'.
Instance Variable renewal_interval Minimum seconds between renewal writes for unchanged scalar payloads. Zero renews every request. Must be strictly below the lifetime in seconds so renewal can occur while the session is still valid. Mutable payloads and dirty sessions are always persisted.
Instance Variable same_site SameSite cookie policy. Defaults to SameSitePolicy.LAX.
Instance Variable secure Restrict cookies to HTTPS. Defaults to False.
Instance Variable table Database table for session storage (database driver). Defaults to 'sessions'.
Instance Variable track_previous_url Remember successful navigation URLs in the session. Defaults to True.

Inherited from BaseEntity:

Class Method _cachedFieldMetadata Retrieve field definitions and normalized types cached by class.
Method __init__ Initialize declared fields and public extra attributes.
Method _dynamicAttributes Return public instance attributes that are not declared fields.
Method _validateExtraNames Validate names and storage for public extra attributes.
Method getFields Describe declared fields and, optionally, dynamic attributes.
Method toDict Return a recursively copied dictionary of declared and extra values.
Class Variable __slots__ Declare that this class introduces no additional instance slots.
Class Variable _orionis_field_metadata Cache declared fields and normalized type names for each concrete class.
def __post_init__(self): (source)

Validate all fields after dataclass initialisation.

Called automatically by the dataclass machinery immediately after __init__. Delegates to individual field validators in a deterministic order.

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
def __validateBooleans(self): (source)

Validate all boolean fields in a single pass.

Iterate over every boolean field and raise on the first value that is not a bool instance.

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
TypeErrorIf any boolean field holds a non-boolean value.
def __validateCache(self): (source)

Validate the cache field.

When provided the value must be a non-empty string naming a cache store (cache driver).

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
ValueErrorIf cache is provided but is not a non-empty string.
def __validateConnection(self): (source)

Validate the connection field.

When provided the value must be a non-empty string naming a database connection (database driver).

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
ValueErrorIf connection is provided but is not a non-empty string.
def __validateCookie(self): (source)

Validate the cookie field.

The cookie name must conform to the restrictions imposed by RFC 6265.

Returns
NoneThis method performs validation and returns None.
Raises
ValueErrorIf the cookie name is invalid.
def __validateDomain(self): (source)

Validate the domain field.

When provided the domain must be a non-empty string that does not begin or end with a dot and contains no consecutive dots.

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
ValueErrorIf domain is an empty string or violates dot rules.
def __validateDriver(self): (source)

Normalise and validate the driver field.

Accept a SessionDriver enum member or a plain string matching a recognised driver name (case-insensitive). When a valid string is supplied it is coerced to the corresponding SessionDriver member via object.__setattr__.

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneMutates driver in-place when a plain string is given.
Raises
ValueErrorIf the string does not match any registered driver name.
TypeErrorIf the value is neither a str nor a SessionDriver.
def __validateFiles(self): (source)

Validate the files path field.

When provided the value must be a non-empty string pointing to the directory used by the file session driver.

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
ValueErrorIf files is provided but is not a non-empty string.
def __validateLifetime(self): (source)

Validate the lifetime field.

The lifetime represents the server-side session duration in minutes and must be a strictly positive integer.

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
TypeErrorIf lifetime is not an int.
ValueErrorIf lifetime is not strictly greater than zero.
def __validatePath(self): (source)

Validate the path field.

The cookie path must be a string that begins with '/' as required by RFC 6265 §4.1.1.

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
ValueErrorIf path is not a string or does not start with '/'.
def __validateSameSite(self): (source)

Normalise and validate the same_site field.

Accept a SameSitePolicy member or a plain string. The stored value is always the canonical lowercase string form of the policy (e.g. "lax").

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneMutates same_site in-place to its canonical string form.
Raises
ValueErrorIf the string is not a valid SameSitePolicy value.
TypeErrorIf the value is neither a str nor a SameSitePolicy.
def __validateTable(self): (source)

Validate the table field.

When provided the value must be a non-empty string naming the database table used to persist session records (database driver).

Parameters
self:orionis.foundation.config.session.SessionThe Session instance being validated.
Returns
NoneNo value is returned.
Raises
ValueErrorIf table is provided but is not a non-empty string.
cache: str | None = (source)

Cache store for session storage (cache driver). Defaults to None.

connection: str | None = (source)

Database connection for session storage (database driver). Defaults to None.

Name of the session cookie. Defaults to 'sessionid'.

domain: str | None = (source)

Cookie domain for cross-subdomain usage.

driver: str | orionis.foundation.config.session.SessionDriver = (source)

Session driver. Defaults to SessionDriver.MEMORY.

expire_on_close: bool = (source)

Expire session on browser close (omits Max-Age). Defaults to False.

files: str | None = (source)

Path to session files (file driver). Defaults to 'storage/framework/sessions'.

http_only: bool = (source)

Prevent JavaScript from accessing the cookie. Defaults to True.

lifetime: int = (source)

Session lifetime in minutes. Defaults to 120.

partitioned: bool = (source)

Enable CHIPS (partitioned) cookies. Defaults to False.

Cookie path. Defaults to '/'.

renewal_interval: int = (source)

Minimum seconds between renewal writes for unchanged scalar payloads. Zero renews every request. Must be strictly below the lifetime in seconds so renewal can occur while the session is still valid. Mutable payloads and dirty sessions are always persisted.

same_site: str | orionis.foundation.config.session.enums.SameSitePolicy = (source)

SameSite cookie policy. Defaults to SameSitePolicy.LAX.

Restrict cookies to HTTPS. Defaults to False.

table: str | None = (source)

Database table for session storage (database driver). Defaults to 'sessions'.

track_previous_url: bool = (source)

Remember successful navigation URLs in the session. Defaults to True.