memory (persistent, sqlite): fixed getPrivates bug with keys arguments and its use in LazyPersistentBinaryDict
This commit is contained in:
parent
d067b1b8be
commit
06fd34fe5e
2 changed files with 6 additions and 3 deletions
|
|
@ -201,7 +201,9 @@ class LazyPersistentBinaryDict(PersistentBinaryDict):
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
"""get the value as a Deferred"""
|
"""get the value as a Deferred"""
|
||||||
return self.storage.getPrivates(self.namespace, keys=[key], binary=self.binary, profile=self.profile)
|
d = self.storage.getPrivates(self.namespace, keys=[key], binary=self.binary, profile=self.profile)
|
||||||
|
d.addCallback(lambda data: data[key])
|
||||||
|
return d
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
self.storage.setPrivateValue(self.namespace, key, value, self.binary, self.profile)
|
self.storage.setPrivateValue(self.namespace, key, value, self.binary, self.profile)
|
||||||
|
|
|
||||||
|
|
@ -571,8 +571,9 @@ class SqliteStorage(object):
|
||||||
args = [namespace]
|
args = [namespace]
|
||||||
|
|
||||||
if keys is not None:
|
if keys is not None:
|
||||||
query_parts.append(u'AND key IN ?')
|
placeholders = u','.join(len(keys) * u'?')
|
||||||
args.append(keys)
|
query_parts.append(u'AND key IN (' + placeholders + u')')
|
||||||
|
args.extend(keys)
|
||||||
|
|
||||||
if profile is not None:
|
if profile is not None:
|
||||||
query_parts.append(u'AND profile_id=?')
|
query_parts.append(u'AND profile_id=?')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue