diff --git a/src/memory/persistent.py b/src/memory/persistent.py index 6d7dba1e..ea93e23e 100644 --- a/src/memory/persistent.py +++ b/src/memory/persistent.py @@ -201,7 +201,9 @@ class LazyPersistentBinaryDict(PersistentBinaryDict): def __getitem__(self, key): """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): self.storage.setPrivateValue(self.namespace, key, value, self.binary, self.profile) diff --git a/src/memory/sqlite.py b/src/memory/sqlite.py index 55ea32b1..80410c17 100644 --- a/src/memory/sqlite.py +++ b/src/memory/sqlite.py @@ -571,8 +571,9 @@ class SqliteStorage(object): args = [namespace] if keys is not None: - query_parts.append(u'AND key IN ?') - args.append(keys) + placeholders = u','.join(len(keys) * u'?') + query_parts.append(u'AND key IN (' + placeholders + u')') + args.extend(keys) if profile is not None: query_parts.append(u'AND profile_id=?')