class documentation

A persistent session manager for Quixote.

Method __init__ __init__ takes a session store instance and (optionally) the session class to use for storing session information. (This defaults to Session.Session).
Method __repr__ Undocumented
Method clear_session Clear any residual session information for this request.
Method expire_session Expire the current session, ie. revoke the session cookie from the client, remove the session object from the current request, and list it for permanent removal.
Method finish_failed_request Called near the end of a failed request (i.e. a exception that was not a PublisherError was raised.
Method finish_successful_request Called near the end of each successful request. Not called if there were any errors processing the request.
Method get_session Fetch or create a session object for the current session, and return it. If a session cookie is found in the HTTP request object, use it to look up and return an existing session object. If no session cookie is found, create a new session.
Method has_session Return true if a session identified by 'session_id' exists in the session manager.
Method has_session_cookie Return true if the request already has a cookie identifying a session object. If 'must_exist' is true, the cookie must correspond to a currently existing session; otherwise (the default), we just check for the existence of the session cookie and don't inspect its content at all.
Method maintain_session Maintain session information. This method is called after servicing an HTTP request, just before the response is returned. If a session contains information a cookie is dropped on the client and True is returned...
Method new_session Return a new session object, ie. an instance of the session_class class passed to the constructor (defaults to Session).
Method revoke_session_cookie Remove the session cookie from the remote user's session by resetting the value and maximum age in the response object. Also remove the cookie from the request so that further processing of this request does not see the cookie's revoked value.
Method set_session_cookie Ensure that a session cookie with value 'session_id' will be returned to the client via the response object.
Method start_request Called near the beginning of each request: after the HTTPRequest object has been built, but before we traverse the URL or call the callable object found by URL traversal.
Constant ACCESS_TIME_RESOLUTION Undocumented
Instance Variable expired_sessions Undocumented
Instance Variable session_class Undocumented
Instance Variable store Undocumented
Method _create_session Undocumented
Method _get_session_id Find the ID of the current session by looking for the session cookie in the request. Return None if no such cookie or the cookie has been expired, otherwise return the cookie's value.
Method _make_session_id Undocumented
Method _set_cookie Undocumented
def __init__(self, store_obj, session_class=Session):

__init__ takes a session store instance and (optionally) the session class to use for storing session information. (This defaults to Session.Session).

def __repr__(self):

Undocumented

def clear_session(self, request):

Clear any residual session information for this request.

def expire_session(self):

Expire the current session, ie. revoke the session cookie from the client, remove the session object from the current request, and list it for permanent removal.

def finish_failed_request(self):

Called near the end of a failed request (i.e. a exception that was not a PublisherError was raised.

def finish_successful_request(self):

Called near the end of each successful request. Not called if there were any errors processing the request.

def get_session(self) -> Session:

Fetch or create a session object for the current session, and return it. If a session cookie is found in the HTTP request object, use it to look up and return an existing session object. If no session cookie is found, create a new session.

Note that this method does not cause the new session to be stored in the session manager, nor does it drop a session cookie on the user --- those are both the responsibility of [finish_successful_request()](#section-14).

def has_session(self, session_id: str) -> bool:

Return true if a session identified by 'session_id' exists in the session manager.

def has_session_cookie(self, must_exist: bool = False) -> bool:

Return true if the request already has a cookie identifying a session object. If 'must_exist' is true, the cookie must correspond to a currently existing session; otherwise (the default), we just check for the existence of the session cookie and don't inspect its content at all.

def maintain_session(self, session) -> bool:

Maintain session information. This method is called after servicing an HTTP request, just before the response is returned. If a session contains information a cookie is dropped on the client and True is returned. If not, the session is forcibly expired and False is returned.

def new_session(self, id: str|None) -> Session:

Return a new session object, ie. an instance of the session_class class passed to the constructor (defaults to Session).

def revoke_session_cookie(self):

Remove the session cookie from the remote user's session by resetting the value and maximum age in the response object. Also remove the cookie from the request so that further processing of this request does not see the cookie's revoked value.

def set_session_cookie(self, session_id: str):

Ensure that a session cookie with value 'session_id' will be returned to the client via the response object.

def start_request(self):

Called near the beginning of each request: after the HTTPRequest object has been built, but before we traverse the URL or call the callable object found by URL traversal.

ACCESS_TIME_RESOLUTION: int =

Undocumented

Value
1
expired_sessions: dict =

Undocumented

session_class =

Undocumented

store =

Undocumented

def _create_session(self):

Undocumented

def _get_session_id(self, config) -> str|None:

Find the ID of the current session by looking for the session cookie in the request. Return None if no such cookie or the cookie has been expired, otherwise return the cookie's value.

def _make_session_id(self):

Undocumented

def _set_cookie(self, value, **attrs):

Undocumented