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 Session(BaseEntity): (source)
Configure the session middleware.
| Parameters | |
| driver | Session driver. Defaults to SessionDriver.MEMORY. |
| lifetime | Session lifetime in minutes. Defaults to 120. |
| expire | Expire session on browser close (omits Max-Age). Defaults to False. |
| track | Remember successful navigation URLs in the session. Defaults to True. |
| 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. |
| files | Path to session files (file driver). Defaults to 'storage/framework/sessions'. |
| connection | Database connection for session storage (database driver). Defaults to None. |
| table | Database table for session storage (database driver). Defaults to 'sessions'. |
| cache | Cache store for session storage (cache driver). Defaults to None. |
| cookie | Name of the session cookie. Defaults to 'sessionid'. |
| path | Cookie path. Defaults to '/'. |
| domain | Cookie domain for cross-subdomain usage. |
| secure | Restrict cookies to HTTPS. Defaults to False. |
| http | Prevent JavaScript from accessing the cookie. Defaults to True. |
| same | SameSite cookie policy. Defaults to SameSitePolicy.LAX. |
| partitioned | Enable CHIPS (partitioned) cookies. Defaults to False. |
| 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. |
| Class Variable | cache |
Undocumented |
| Class Variable | connection |
Undocumented |
| Class Variable | cookie |
Undocumented |
| Class Variable | domain |
Undocumented |
| Class Variable | driver |
Undocumented |
| Class Variable | expire |
Undocumented |
| Class Variable | files |
Undocumented |
| Class Variable | http |
Undocumented |
| Class Variable | lifetime |
Undocumented |
| Class Variable | partitioned |
Undocumented |
| Class Variable | path |
Undocumented |
| Class Variable | renewal |
Undocumented |
| Class Variable | same |
Undocumented |
| Class Variable | secure |
Undocumented |
| Class Variable | table |
Undocumented |
| Class Variable | track |
Undocumented |
Inherited from BaseEntity:
| Class Method | _cached |
Retrieve field definitions and normalized types cached by class. |
| Method | get |
Describe field names, normalized types, defaults, and metadata. |
| Method | to |
Convert the dataclass instance to a recursively copied dictionary. |
| Class Variable | __slots__ |
Undocumented |
Validate the cache field.
When provided the value must be a non-empty string naming a cache store (cache driver).
| Parameters | |
self: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: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: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: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: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: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: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: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: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. |