summaryrefslogtreecommitdiff
path: root/mail
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
commitf30d72a3b8c6187d5fc29e05c44b03f2d46eeac3 (patch)
treea09ca9f2dd95014213b039f40de252ee585f54c3 /mail
parent2f5ea5dd08fb62203c04d0588dfc2f945c45bf8e (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 'mail')
-rw-r--r--mail/src/leap/mail/mailbox_indexer.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/mail/src/leap/mail/mailbox_indexer.py b/mail/src/leap/mail/mailbox_indexer.py
index 3bec41e3..732a6eeb 100644
--- a/mail/src/leap/mail/mailbox_indexer.py
+++ b/mail/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)