comparison 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
comparison
equal deleted inserted replaced
1028:127c96020022 1029:f6182f6418ea
41 self._cache = {} 41 self._cache = {}
42 self.namespace = namespace 42 self.namespace = namespace
43 self.profile = profile 43 self.profile = profile
44 44
45 def load(self): 45 def load(self):
46 """load persistent data from storage 46 """Load persistent data from storage.
47
48 @return: defers the PersistentDict instance itself
47 """ 49 """
48 if not self.profile: 50 if not self.profile:
49 return self.storage.loadGenPrivates(self._cache, self.namespace) 51 d = self.storage.loadGenPrivates(self._cache, self.namespace)
50 else: 52 else:
51 return self.storage.loadIndPrivates(self._cache, self.namespace, self.profile) 53 d = self.storage.loadIndPrivates(self._cache, self.namespace, self.profile)
54 return d.addCallback(lambda dummy: self)
52 55
53 def __repr__(self): 56 def __repr__(self):
54 return self._cache.__repr__() 57 return self._cache.__repr__()
55 58
56 def __str__(self): 59 def __str__(self):