Package advene :: Package util :: Module session
[hide private]
[frames] | no frames]

Module session

source code

A module for managing session-wide global data.

This module provides the ``session`` object, storing variables on a per-thread basis: each thread has its own values for the session variables.

A set of session variables are predefined and have a default value (the dict ``get_session_defaults`` returns them in a dict). User-defined session variables can be used but must be prefixed with "x_". Note that deleting a predefined session variable does not actually deletes it but restores it to its default value.

All errors (trying to read or delete an non-existant session variable, or trying to set an invalid one) raise AttributeError.

E.g.:

   from advene.util.session import session
   session.package = some_package
   session.user = "pchampin"
   session.x_info = "some additional info"
   # those variables are only set in the scope of the current thread
Classes [hide private]
  _Session
Functions [hide private]
 
get_session_defaults() source code
 
cleanup()
Remove the temp.
source code
Variables [hide private]
  _session_defaults = {'package': None, 'user': 'oaubert'}
  tempdir_list = []
  session = _Session()
Function Details [hide private]

cleanup()

source code 

Remove the temp. directories used during the session.

No check is done to see wether it is in use or not. This method is intended to be used at the end of the application, to clean up the mess.