Package wtf :: Package app :: Package services :: Module session :: Class Session
[hide private]
[frames] | no frames]

Class Session

source code

object --+
         |
        Session

Session object
Instance Methods [hide private]
 
__init__(self, adapter)
Initialization
source code
any
__getattr__(self, name)
Resolve magic sesison attributes magically
source code
 
__delitem__(self, name)
Delete a session attribute
source code
 
__setitem__(self, name, value)
Set or replace a session attribute
source code
any
__getitem__(self, name)
Determine the value of an attribute
source code
 
get(self, name, default=None)
Determine the value of an attribute
source code
bool
__contains__(self, name)
Determine if an attribute exists in the session
source code
bool
has_key(self, name)
Determine if an attribute exists in the session
source code
 
new(self, **kwargs)
Create a new session
source code
 
invalidate(self)
Invalidate the session
source code

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

Instance Variables [hide private]
StorageAdapter _adapter
Storage adapter
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, adapter)
(Constructor)

source code 
Initialization
Parameters:
Overrides: object.__init__

__getattr__(self, name)
(Qualification operator)

source code 
Resolve magic sesison attributes magically
Parameters:
  • name (str) - The magic name to resolve
Returns: any
The value of the magic attribute
Raises:
  • AttributeError - Attribute not found

__delitem__(self, name)
(Index deletion operator)

source code 

Delete a session attribute

If the attribute did not exist before, this is not an error (just a no-op).

Parameters:
  • name (str) - Name of the attribute

__setitem__(self, name, value)
(Index assignment operator)

source code 
Set or replace a session attribute
Parameters:
  • name (str) - Attribute name
  • value (any) - Attribute value (must be picklable)

__getitem__(self, name)
(Indexing operator)

source code 
Determine the value of an attribute
Parameters:
  • name (str) - Attribute name
Returns: any
Attribute value
Raises:
  • KeyError - The attribute did not exist

get(self, name, default=None)

source code 
Determine the value of an attribute
Parameters:
  • name (str) - The attribute name
  • default (any) - Default value to return in case the attribute does not exist

__contains__(self, name)
(In operator)

source code 
Determine if an attribute exists in the session
Parameters:
  • name (str) - Attribute name to check
Returns: bool
Does it exist?

has_key(self, name)

source code 
Determine if an attribute exists in the session
Parameters:
  • name (str) - Attribute name to check
Returns: bool
Does it exist?

new(self, **kwargs)

source code 
Create a new session
Parameters:
  • kwargs (dict) - Initial attributes ({'name': value, ...})

invalidate(self)

source code 

Invalidate the session

The session is not cleared, but will be unusable with the next request. Call new if you need to create a fresh, empty session after invalidating.