From f30d72a3b8c6187d5fc29e05c44b03f2d46eeac3 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 25 Feb 2015 11:33:12 -0400 Subject: properly catch TypeError exception * fix get_next_uid test * remove duplication of maybe_first_query_item, since get_last_uid also do it now. --- mail/src/leap/mail/mailbox_indexer.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/src/leap/mail/mailbox_indexer.py b/mail/src/leap/mail/mailbox_indexer.py index 3bec41e..732a6ee 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) -- cgit v1.2.3