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.
  Touch(self)
Update the last access time on the session to now.
  GetId(self)
Return the session ID.
  GetUserId(self)
Return the ID of the user who owns this session.
  GetUser(self)
Return the user record for the owning user.
  IsDefaultUser(self)
Return true if the owning user is the default user.
  IsExpired(self)
Return true if this session has expired.
  Validate(self, request)
Make sure the session is OK for a request.

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.

Touch(self)

source code 
Update the last access time on the session to now.

GetId(self)

source code 
Return the session ID.

GetUserId(self)

source code 
Return the ID of the user who owns this session.

GetUser(self)

source code 

Return the user record for the owning user.

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

IsDefaultUser(self)

source code 
Return true if the owning user is the default user.

IsExpired(self)

source code 
Return true if this session has expired.

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.