save storage with get_storage
authorEmmanuel Garette <egarette@cadoles.com>
Mon, 26 Aug 2013 19:54:41 +0000 (21:54 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Mon, 26 Aug 2013 19:54:41 +0000 (21:54 +0200)
list_sessions and delete_session is now in setting directly

tiramisu/setting.py

index c9d4a0b..952d52a 100644 (file)
@@ -48,9 +48,8 @@ class StorageType:
 
     def get_storage(self):
         if self.storage_type is None:
 
     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)
 
         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)
 
 
                       ['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"
 #____________________________________________________________
 class Settings(object):
     "``Config()``'s configuration options"