7.8.1 SessionServerAppMixin

##
7.8.1 SessionServerAppMixin

The application mixin works in concert with the `SessionServerContextMixin` execution context method to store sessions in the Albatross session server.

Whenever there are problems communicating with the session server the class raises a `SessionServerError` exception, which is a subclass of `SessionError`. Unless you have a reason to do otherwise, catch `SessionError` rather than `SessionServerError`, as this allows other Session classes to be substituted with minimal change.

`__init__`( | appid [, server `= 'localhost'`] [, port `= 34343`] [, age `= 1800`])

  When you inherit from the `SessionServerAppMixin` class you must call this constructor.

  The appid argument specifies the name of the cookie attribute which is used to store the session id. This uniquely identifies the application at the web server. Multiple applications can share sessions by defining the same value in this argument.

  The server and port arguments specify the location of the Albatross session server. By using a session server you can have a number of web serving machines which transparently share session data.

  The age argument specifies how long (in seconds) an idle session will be stored at the server before it is discarded.

  A connection to the session server is established. The connection will be kept open for the lifetime of the application object.

`ses_appid`( | )

  Returns the appid argument which was passed to the constructor.

`get_session`( | sesid)

  Returns the session identified by sesid argument and the appid passed to the constructor. If no such session exists `None` is returned.

`new_session`( | )

  Returns a new session id for the appid passed to the constructor.

`put_session`( | sesid, text)

  Saves the text argument as session data for the session identified by sesid argument and the appid passed to the constructor.

`del_session`( | sesid)

  Removes the session identified by sesid argument and the appid passed to the constructor.