summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-02-25 11:33:12 -0400
committerKali Kaneko <kali@leap.se>2015-03-03 14:20:39 -0400
commit4a0a785750e8b6a2de374c9859b98c855d807984 (patch)
treee82276fb66ef7943d13c5022857993d66ead3447 /src
parent70a42a8de216468175048bfc517035aa66ce9e95 (diff)
properly catch TypeError exception
* fix get_next_uid test * remove duplication of maybe_first_query_item, since get_last_uid also do it now.
Diffstat (limited to 'src')
-rw-r--r--src/leap/mail/mailbox_indexer.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/leap/mail/mailbox_indexer.py b/src/leap/mail/mailbox_indexer.py
index 3bec41e..732a6ee 100644
--- a/src/leap/mail/mailbox_indexer.py
+++ b/src/leap/mail/mailbox_indexer.py
@@ -30,7 +30,7 @@ def _maybe_first_query_item(thing):
"""
try:
return thing[0][0]
- except IndexError:
+ except (TypeError, IndexError):
return None
@@ -280,10 +280,7 @@ class MailboxIndexer(object):
check_good_uuid(mailbox_uuid)
def increment(result):
- uid = _maybe_first_query_item(result)
- if uid is None:
- return 1
- return uid + 1
+ return result + 1
d = self.get_last_uid(mailbox_uuid)
d.addCallback(increment)