Package cherrypy :: Package lib :: Module sessions :: Class Session
[hide private]
[frames] | no frames]

Class Session

source code

object --+
         |
        Session
Known Subclasses:

A CherryPy dict-like Session object (one per request).

Instance Methods [hide private]
 
_get_id(self) source code
 
_set_id(self, value) source code
 
__init__(self, id=None, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
now(self)
Generate the session specific concept of 'now'.
source code
 
regenerate(self)
Replace the current session (with a new id).
source code
 
_regenerate(self) source code
 
clean_up(self)
Clean up expired sessions.
source code
 
generate_id(self)
Return a new session id.
source code
 
save(self)
Save session data.
source code
 
load(self)
Copy stored session data into this session instance.
source code
 
delete(self)
Delete stored session data.
source code
 
__getitem__(self, key) source code
 
__setitem__(self, key, value) source code
 
__delitem__(self, key) source code
 
pop(self, key, default=False)
Remove the specified key and return the corresponding value.
source code
 
__contains__(self, key) source code
True if D has a key k, else False.
has_key(D, k) source code
D[k] if k in D, else d
get(D, k, d=...)
d defaults to None.
source code
None
update(D, E)
Update D from E: for k in E: D[k] = E[k].
source code
D.get(k,d), also set D[k]=d if k not in D.
setdefault(D, k, d=...) source code
None
clear(D)
Remove all items from D.
source code
list of D's keys.
keys(D) source code
list of D's (key, value) pairs, as 2-tuples.
items(D) source code
list of D's values.
values(D) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  _id = None
hash(x)
  id_observers = None
A list of callbacks to which to pass new id's.
  timeout = 60
Number of minutes after which to delete session data.
  locked = False
If True, this session instance has exclusive read/write access to session data.
  loaded = False
If True, data has been retrieved from storage.
  clean_thread = None
Class-level Monitor which calls self.clean_up.
  clean_freq = 5
The poll rate for expired session cleanup in minutes.
  originalid = None
The session id passed by the client.
  missing = False
True if the session requested by the client did not exist.
  regenerated = False
True if the application called session.regenerate().
  debug = False
If True, log debug information.
Properties [hide private]
  id
The current session ID.

Inherited from object: __class__

Method Details [hide private]

__init__(self, id=None, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

now(self)

source code 

Generate the session specific concept of 'now'.

Other session providers can override this to use alternative, possibly timezone aware, versions of 'now'.

pop(self, key, default=False)

source code 

Remove the specified key and return the corresponding value. If key is not found, default is returned if given, otherwise KeyError is raised.


Class Variable Details [hide private]

loaded

If True, data has been retrieved from storage. This should happen automatically on the first attempt to access session data.

Value:
False

originalid

The session id passed by the client. May be missing or unsafe.

Value:
None

regenerated

True if the application called session.regenerate(). This is not set by internal calls to regenerate the session id.

Value:
False

Property Details [hide private]

id

The current session ID.

Get Method:
_get_id(self)
Set Method:
_set_id(self, value)