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.
Configure the session middleware.
| Returns | |
None | This class does not return a value. |
| Method | __post |
Validate all fields after dataclass initialisation. |
| Method | __validate |
Validate all boolean fields in a single pass. |
| Method | __validate |
Validate the cache field. |
| Method | __validate |
Validate the connection field. |
| Method | __validate |
Validate the cookie field. |
| Method | __validate |
Validate the domain field. |
| Method | __validate |
Normalise and validate the driver field. |
| Method | __validate |
Validate the files path field. |
| Method | __validate |
Validate the lifetime field. |
| Method | __validate |
Validate the path field. |
| Method | __validate |
Normalise and validate the same_site field. |
| Method | __validate |
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 |
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 |
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 |
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 |
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 |
Remember successful navigation URLs in the session. Defaults to True. |
Inherited from BaseEntity:
| Class Method | _cached |
Retrieve field definitions and normalized types cached by class. |
| Method | __init__ |
Initialize declared fields and public extra attributes. |
| Method | _dynamic |
Return public instance attributes that are not declared fields. |
| Method | _validate |
Validate names and storage for public extra attributes. |
| Method | get |
Describe declared fields and, optionally, dynamic attributes. |
| Method | to |
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 |
Cache declared fields and normalized type names for each concrete class. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
TypeError | If any boolean field holds a non-boolean value. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
ValueError | If cache is provided but is not a non-empty string. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
ValueError | If connection is provided but is not a non-empty string. |
Validate the cookie field.
The cookie name must conform to the restrictions imposed by RFC 6265.
| Returns | |
None | This method performs validation and returns None. |
| Raises | |
ValueError | If the cookie name is invalid. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
ValueError | If domain is an empty string or violates dot rules. |
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.Session | The Session instance being validated. |
| Returns | |
None | Mutates driver in-place when a plain string is given. |
| Raises | |
ValueError | If the string does not match any registered driver name. |
TypeError | If the value is neither a str nor a SessionDriver. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
ValueError | If files is provided but is not a non-empty string. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
TypeError | If lifetime is not an int. |
ValueError | If lifetime is not strictly greater than zero. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
ValueError | If path is not a string or does not start with '/'. |
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.Session | The Session instance being validated. |
| Returns | |
None | Mutates same_site in-place to its canonical string form. |
| Raises | |
ValueError | If the string is not a valid SameSitePolicy value. |
TypeError | If the value is neither a str nor a SameSitePolicy. |
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.Session | The Session instance being validated. |
| Returns | |
None | No value is returned. |
| Raises | |
ValueError | If table is provided but is not a non-empty string. |
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.