summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-02-26 13:04:30 -0400
committerKali Kaneko <kali@leap.se>2015-03-03 14:26:32 -0400
commite7a2e303aaa74fc0b238a84972f023c7df3c4ed9 (patch)
tree6bc07f40739346c0b7cd00481e273d0a2ee04297 /mail
parent0270a05a1d5657a4b085003bd03ee2fbae25d00c (diff)
[bug] increment: avoid TypeError when there's no entries in table
Diffstat (limited to 'mail')
-rw-r--r--mail/src/leap/mail/mailbox_indexer.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/mail/src/leap/mail/mailbox_indexer.py b/mail/src/leap/mail/mailbox_indexer.py
index 732a6eeb..664d5804 100644
--- a/mail/src/leap/mail/mailbox_indexer.py
+++ b/mail/src/leap/mail/mailbox_indexer.py
@@ -278,12 +278,8 @@ class MailboxIndexer(object):
:rtype: Deferred
"""
check_good_uuid(mailbox_uuid)
-
- def increment(result):
- return result + 1
-
d = self.get_last_uid(mailbox_uuid)
- d.addCallback(increment)
+ d.addCallback(lambda uid: uid + 1)
return d
def get_last_uid(self, mailbox_uuid):
@@ -296,7 +292,10 @@ class MailboxIndexer(object):
preffix=self.table_preffix, name=sanitize(mailbox_uuid))
def getit(result):
- return _maybe_first_query_item(result)
+ rowid = _maybe_first_query_item(result)
+ if not rowid:
+ rowid = 0
+ return rowid
d = self._query(sql)
d.addCallback(getit)