From fb1eba39ea80cfc2ea82f39bbcf8e70a9222ace5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 26 Aug 2013 21:54:41 +0200 Subject: [PATCH] save storage with get_storage list_sessions and delete_session is now in setting directly --- tiramisu/setting.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tiramisu/setting.py b/tiramisu/setting.py index c9d4a0b..952d52a 100644 --- a/tiramisu/setting.py +++ b/tiramisu/setting.py @@ -48,9 +48,8 @@ class StorageType: def get_storage(self): if self.storage_type is None: - storage = self.default_storage - else: - storage = self.storage_type + self.storage_type = self.default_storage + storage = self.storage_type return 'tiramisu.storage.{0}.storage'.format( storage) @@ -226,6 +225,16 @@ def get_storage(context, session_id, is_persistent): ['Storage'], -1).Storage(session_id, is_persistent) +def list_sessions(): + return __import__(storage_type.get_storage(), globals(), locals(), + ['list_sessions'], -1).list_sessions() + + +def delete_session(session_id): + return __import__(storage_type.get_storage(), globals(), locals(), + ['delete_session'], -1).delete_session(session_id) + + #____________________________________________________________ class Settings(object): "``Config()``'s configuration options"