From 4a0a785750e8b6a2de374c9859b98c855d807984 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. --- src/leap/mail/mailbox_indexer.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/leap/mail') 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) -- cgit v1.2.3