diff src/memory/persistent.py @ 1029:f6182f6418ea

memory: add class ProfileSessions based on Sessions
author souliane <souliane@mailoo.org>
date Sat, 10 May 2014 17:37:32 +0200
parents 301b342c697a
children b29a065a66f0
line wrap: on
line diff
--- a/src/memory/persistent.py	Wed May 07 15:46:43 2014 +0200
+++ b/src/memory/persistent.py	Sat May 10 17:37:32 2014 +0200
@@ -43,12 +43,15 @@
         self.profile = profile
 
     def load(self):
-        """load persistent data from storage
+        """Load persistent data from storage.
+
+        @return: defers the PersistentDict instance itself
         """
         if not self.profile:
-            return self.storage.loadGenPrivates(self._cache, self.namespace)
+            d = self.storage.loadGenPrivates(self._cache, self.namespace)
         else:
-            return self.storage.loadIndPrivates(self._cache, self.namespace, self.profile)
+            d = self.storage.loadIndPrivates(self._cache, self.namespace, self.profile)
+        return d.addCallback(lambda dummy: self)
 
     def __repr__(self):
         return self._cache.__repr__()