The session object is loaded with the session data before handling the request and saves the session data after handling the request, if modified. Note in the current (11-22-2008) version of web.py, one must turn off debug to use the development server with sessions.

The optional initializer argument to Session specifies the initial session.

You can use DBStore instead of DiskStore if you prefer to store sessions in database instead of disk. For using DBStore you need to have a table with the following schema.