Package qm :: Module web :: Class Session
[hide private]
[frames] | no frames]

Class Session

source code

A persistent user session.

A 'Session' object represents an ongoing user interaction with the web server.

Instance Methods [hide private]
 
__init__(self, request, user_id, expiration_timeout=21600)
Create a new session.
source code
 
Touch(self)
Update the last access time on the session to now.
source code
 
GetId(self)
Return the session ID.
source code
 
GetUserId(self)
Return the ID of the user who owns this session.
source code
 
GetUser(self)
Return the user record for the owning user.
source code
 
IsDefaultUser(self)
Return true if the owning user is the default user.
source code
 
IsExpired(self)
Return true if this session has expired.
source code
 
Validate(self, request)
Make sure the session is OK for a request.
source code
Method Details [hide private]

__init__(self, request, user_id, expiration_timeout=21600)
(Constructor)

source code 

Create a new session.

'request' -- A 'WebRequest' object in response to which this session is created.

'user_id' -- The ID of the user owning the session.

'expiration_timeout -- The expiration time, in seconds. If a session is not accessed for this duration, it is expired and no longer usable.

GetUser(self)

source code 

Return the user record for the owning user.

returns -- A 'qm.user.User' object.

Validate(self, request)

source code 

Make sure the session is OK for a request.

'request' -- A 'WebRequest' object.

raises -- 'InvalidSessionError' if the session is invalid for the request.