summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-03-11 19:38:13 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-03-11 19:38:13 -0300
commit9819b78e0f35b729d409b8e2d1c42fd99d7434ee (patch)
treedcced515dbba39265529bfa4062ec41771c13032 /service/pixelated/adapter
parenta6c98d79d49d512235259c6fd3271dc9fa74bada (diff)
for #315, check query parameter and return empty if they are empty, not an error
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r--service/pixelated/adapter/soledad/soledad_facade_mixin.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/service/pixelated/adapter/soledad/soledad_facade_mixin.py b/service/pixelated/adapter/soledad/soledad_facade_mixin.py
index 046d6bf7..2dad78b8 100644
--- a/service/pixelated/adapter/soledad/soledad_facade_mixin.py
+++ b/service/pixelated/adapter/soledad/soledad_facade_mixin.py
@@ -21,7 +21,7 @@ class SoledadDbFacadeMixin(object):
return self.soledad.get_from_index('by-type', 'flags')
def get_all_flags_by_mbox(self, mbox):
- return self.soledad.get_from_index('by-type-and-mbox', 'flags', mbox)
+ return self.soledad.get_from_index('by-type-and-mbox', 'flags', mbox) if mbox else []
def get_content_by_phash(self, phash):
content = self.soledad.get_from_index('by-type-and-payloadhash', 'cnt', phash) if phash else []
@@ -29,17 +29,17 @@ class SoledadDbFacadeMixin(object):
return content[0]
def get_flags_by_chash(self, chash):
- flags = self.soledad.get_from_index('by-type-and-contenthash', 'flags', chash)
+ flags = self.soledad.get_from_index('by-type-and-contenthash', 'flags', chash) if chash else []
if len(flags):
return flags[0]
def get_header_by_chash(self, chash):
- header = self.soledad.get_from_index('by-type-and-contenthash', 'head', chash)
+ header = self.soledad.get_from_index('by-type-and-contenthash', 'head', chash) if chash else []
if len(header):
return header[0]
def get_recent_by_mbox(self, mbox):
- return self.soledad.get_from_index('by-type-and-mbox', 'rct', mbox)
+ return self.soledad.get_from_index('by-type-and-mbox', 'rct', mbox) if mbox else []
def put_doc(self, doc):
return self.soledad.put_doc(doc)
@@ -51,13 +51,13 @@ class SoledadDbFacadeMixin(object):
return self.soledad.delete_doc(doc)
def idents_by_mailbox(self, mbox):
- return set(doc.content['chash'] for doc in self.soledad.get_from_index('by-type-and-mbox-and-deleted', 'flags', mbox, '0'))
+ return set(doc.content['chash'] for doc in self.soledad.get_from_index('by-type-and-mbox-and-deleted', 'flags', mbox, '0')) if mbox else set()
def get_all_mbox(self):
return self.soledad.get_from_index('by-type', 'mbox')
def get_mbox(self, mbox):
- return self.soledad.get_from_index('by-type-and-mbox', 'mbox', mbox)
+ return self.soledad.get_from_index('by-type-and-mbox', 'mbox', mbox) if mbox else []
def get_search_index_masterkey(self):
return self.soledad.get_from_index('by-type', 'index_key')