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.
Coordinate the session lifecycle for every HTTP request.
This class is a coordinator only. It never stores session data, never interprets the session payload, and never duplicates logic that belongs to Session or to the backing store.
| Parameters | |
| app | Application providing session configuration and filesystem paths. |
| cache | Cache manager used when the configured session store is cache-backed. |
| Method | __delete |
Set an expired cookie to instruct the browser to clear it. |
| Method | __init__ |
Initialise the manager, pre-computing all request-invariant values. |
| Async Method | __invalidate |
Remove the session record and expire the cookie on response. |
| Async Method | __persist |
Write the current session state to the backing store. |
| Method | __register |
Register the session in the application container. |
| Method | __resolve |
Resolve and return the configured session store implementation. |
| Async Method | __restore |
Load a session from the store, or return a blank lazy session. |
| Async Method | __rotate |
Replace the session ID, deleting the old record from the store. |
| Method | __set |
Attach the session identifier cookie to response. |
| Async Method | abort |
Persist pending revocation when a request cannot produce a response. |
| Async Method | save |
Persist the session and set the cookie on response. |
| Async Method | start |
Restore or create a session for the incoming request. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | _app |
The application instance. |
| Instance Variable | _cookie |
Cookie domain obtained from config.domain. |
| Instance Variable | _cookie |
Cookie http only obtained from config.http_only. |
| Instance Variable | _cookie |
Lifetime applied to the session cookie. |
| Instance Variable | _cookie |
Cookie name obtained from config.cookie. |
| Instance Variable | _cookie |
Cookie partitioned obtained from config.partitioned. |
| Instance Variable | _cookie |
Cookie path obtained from config.path. |
| Instance Variable | _cookie |
Cookie same site produced by getattr. |
| Instance Variable | _cookie |
Cookie secure obtained from config.secure. |
| Instance Variable | _lifetime |
Lifetime delta produced by timedelta. |
| Instance Variable | _renewal |
Interval used to calculate the next session renewal deadline. |
| Instance Variable | _renewal |
Window during which a session becomes eligible for renewal. |
| Instance Variable | _store |
Pre-built backing-store instance. |
| Instance Variable | _track |
Track previous url obtained from config.track_previous_url. |
| Property | tracks |
Return whether session middleware remembers successful navigation URLs. |
Set an expired cookie to instruct the browser to clear it.
| Parameters | |
response:orionis.http.Response | The outgoing response. |
| Returns | |
None | No return value. |
Initialise the manager, pre-computing all request-invariant values.
| Parameters | |
app:orionis.IApplication | The application instance. |
cache:orionis.cache.contracts.ICacheManager | The application's cache manager, injected so the cache-backed store can be built without depending on the Cache facade's pin state. |
| Returns | |
None | No return value. |
Remove the session record and expire the cookie on response.
| Parameters | |
response:orionis.http.Response | Response on which the expired cookie is set. |
session:orionis.session.session.Session | The session to remove. |
| Returns | |
None | No return value. |
Write the current session state to the backing store.
| Parameters | |
session:orionis.session.session.Session | The session to persist. session.id must not be None. |
| Returns | |
bool | False if a restored session has already been revoked or expired. |
Register the session in the application container.
| Parameters | |
session:orionis.session.session.Session | The session to register. |
| Returns | |
None | No return value. |
Path, config: SessionConfig, cache: ICacheManager) -> ISessionStore:
(source)
¶
Resolve and return the configured session store implementation.
| Parameters | |
basepathlib.Path | Base project path used to resolve file-store directories. |
config:orionis.foundation.config.session.Session | Session configuration containing the selected driver. |
cache:orionis.cache.contracts.ICacheManager | The application's cache manager, used by the cache driver. |
| Returns | |
orionis.session.contracts.ISessionStore | Store implementing the selected file, cache, database or memory driver. |
Load a session from the store, or return a blank lazy session.
The store is trusted to handle expiry: a None return means the record was absent or already expired.
| Parameters | |
sessionstr | The identifier read from the session cookie. |
| Returns | |
orionis.session.session.Session | Restored session, or a blank lazy session on cache miss. |
Replace the session ID, deleting the old record from the store.
| Parameters | |
session:orionis.session.session.Session | The session whose ID is to be rotated. |
| Returns | |
bool | False if another request has already invalidated the old ID. |
_http.Response, session_id: str, *, expired: bool = False):
(source)
¶
Attach the session identifier cookie to response.
| Parameters | |
response:orionis.http.Response | The outgoing response. |
sessionstr | The session identifier to embed in the cookie value. |
expired:bool, optional | Whether to expire the cookie while preserving its configured policy. |
| Returns | |
None | No return value. |
Persist pending revocation when a request cannot produce a response.
| Parameters | |
session:orionis.session.session.Session | Session belonging to a failed or cancelled request. |
| Returns | |
None | No return value. |
Persist the session and set the cookie on response.
No-op when the session was never activated. With a renewal interval, unchanged scalar payloads retain their existing store and cookie expiry until the deadline; mutable payloads are always persisted. Browser session cookies still omit Max-Age when expire_on_close is enabled.
| Parameters | |
response:orionis.http.Response | Outgoing HTTP response. |
session:orionis.session.session.Session | The session returned by start(). |
| Returns | |
None | No return value. |
Restore or create a session for the incoming request.
| Parameters | |
request:orionis.http.Request | The incoming HTTP request. |
| Returns | |
orionis.session.session.Session | An active or blank lazy session, with flash data aged. |