1.10.3 Session Object Reference

The session object supports the following methods:

class session( )

get( key, [block=True])
Get the value of key from the session store. If block is True reserved keys will be blocked otherwise the method will return their value.

set( key, key, [block=True])
Set the value of key to the value value in the session store. If block is True reserved keys will be blocked otherwise they will be set.

delete( key, [block=True])
Remove the variable key from the session store. If block is True reserved keys will be blocked.

has_key( key, [block=True])
Returns True if key exists on the session store otherwise False. If Key is a blocked variable and block is True the method will return False.

destroy( [removeCookie=False])
Destroy the session and remove all session data. If removeCookie is True an HTTP header is produced to remove the cookie.

Warning: If you set removeCookie to True then you have to be sure you haven't already output the Content-type HTTP header or the cookie HTTP header will just be displayed as plain text.

valid( )
Returns True if the session is still valid, False otherwise.

reserve( key)
Add a reserved key

release( key)
Release a reserved key so that it can be used again.

All session objects also have the read only member variables which you should not set:

sessionID
The session ID for the current session. This is a 32 character string.
app
The name of the application using this session object
expire
The expire length in seconds (the minimum length of the session)
cookie
A dictionary containing the cookie parameters. Warning: Setting the values of the cookie dictionary will have no effect since the cookie is only set if no session is present and only in the start() method of the session module.
seed
The seed used to generate the session ID
cleanup
The probability of checking for expired sessions
reserved
A list of reserved sessio variable keys.

See About this document... for information on suggesting changes.