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).

clean_freq [= 5]:
    The poll rate for expired session cleanup in minutes.

clean_thread [= None]:
    Class-level Monitor which calls self.clean_up.

id [= <property object at 0x1d70260>]:
    The current session ID.

id_observers [= None]:
    A list of callbacks to which to pass new id's.

loaded [= False]:
    
    If True, data has been retrieved from storage. This should happen
    automatically on the first attempt to access session data.

locked [= False]:
    
    If True, this session instance has exclusive read/write access
    to session data.

timeout [= 60]:
    Number of minutes after which to delete session data.

Nested Classes [hide private]
  __metaclass__
Metaclass for declaring docstrings for class attributes.
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
 
regenerate(self)
Replace the current session (with a new id).
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=object())
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
hash(x)
  id_observers__doc = "A list of callbacks to which to pass new ...
  id__doc = "The current session ID."
  timeout = 60
  timeout__doc = "Number of minutes after which to delete sessio...
  locked = False
  locked__doc = ...
  loaded = False
  loaded__doc = ...
  clean_thread = None
hash(x)
  clean_thread__doc = "Class-level Monitor which calls self.clea...
  clean_freq = 5
  clean_freq__doc = "The poll rate for expired session cleanup i...
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)

pop(self, key, default=object())

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]

id_observers__doc

Value:
"A list of callbacks to which to pass new id's."

timeout__doc

Value:
"Number of minutes after which to delete session data."

locked__doc

Value:
"""
    If True, this session instance has exclusive read/write access
    to session data."""

loaded__doc

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

clean_thread__doc

Value:
"Class-level Monitor which calls self.clean_up."

clean_freq__doc

Value:
"The poll rate for expired session cleanup in minutes."

Property Details [hide private]

id

The current session ID.

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