7.7.4 SessionServerContextMixin

This class works in concert with the SessionServerAppMixin application mixin class to store session data in the Albatross session server. All management of session data storage is performed by the application class.

Inherits from the SessionBase class so you must call the constructor if you subclass this class.

__init__( )
When you inherit from the SessionServerContextMixin class you must call this constructor.

sesid( )
Returns the session id.

load_session( )
This is usually called from the Application class load_session() method. Retrieves the session id and then either retrieves an existing session or creates a new session via the application object.

If an existing session is retrieved it is passed to base64.decodestring() and zlib.decompress() then passed to the decode_session() method (inherited from the superclass). If an exception is raised during decode_session() then the session will be deleted from the server and a new session will be created via the application object new_session() method.

save_session( )
This is called from the Application class save_session() method at the end of the request processing sequence. If the session save flag has been cleared via the set_save_session() method then the session is not saved.

Before saving a session the method calls the superclass encode_session() then calls zlib.compress() and base64.encodestring() to convert the session to plain text which is passed to the put_session() application method to save the session.

remove_session( )
This is called from the Application class remove_session() method. The method calls the superclass remove_session() then calls the del_session() application method to remove the session at the server.