comment storage

This commit is contained in:
Emmanuel Garette 2013-09-06 23:53:19 +02:00
parent 22bfbb9fa4
commit c8876ab184
1 changed files with 20 additions and 2 deletions

View File

@ -21,7 +21,9 @@
"""Storage connections, executions and managements.
Storage is basic components used to set informations in DB
Storage is basic components used to set Config informations in DB.
The primary "entry point" class into this package is the StorageType and it's
public configurator ``set_storage()``.
"""
@ -31,6 +33,10 @@ from tiramisu.i18n import _
class StorageType(object):
"""Object to store storage's type. If a Config is already set,
default storage is store as selected storage. You cannot change it
after.
"""
default_storage = 'dictionary'
storage_type = None
mod = None
@ -57,6 +63,13 @@ storage_type = StorageType()
def set_storage(name, **args):
"""Change storage's configuration
:params name: is the storage name. If storage is already set, cannot
reset storage name
Other attributes are differents according to the selected storage's name
"""
storage_type.set(name)
settings = storage_type.get().Setting()
for option, value in args.items():
@ -80,11 +93,16 @@ def get_storage(context, session_id, persistent):
def list_sessions():
"""List all available session (persistent or not persistent)
"""
return storage_type.get().list_sessions()
def delete_session(session_id):
"""Delete a selected session, be careful, you can deleted a session
use by an other instance
"""
return storage_type.get().delete_session(session_id)
#__all__ = (,)
__all__ = (set_storage, list_sessions, delete_session)