summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/fetch.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2013-08-05 17:03:07 +0200
committerKali Kaneko <kali@leap.se>2013-08-05 17:03:07 +0200
commita16ca973433dc44cb71df14ed1e999b35f20ce03 (patch)
treea889a4c76cbf0d25b2e588989376bf14d4cfb65f /src/leap/mail/imap/fetch.py
parent4721a4dcd5eae947cc1204f9a85af9af6dc977b8 (diff)
use the right import path
Diffstat (limited to 'src/leap/mail/imap/fetch.py')
-rw-r--r--src/leap/mail/imap/fetch.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/leap/mail/imap/fetch.py b/src/leap/mail/imap/fetch.py
index 48a45e6..566873b 100644
--- a/src/leap/mail/imap/fetch.py
+++ b/src/leap/mail/imap/fetch.py
@@ -1,15 +1,15 @@
import logging
import json
+import ssl
from twisted.python import log
from twisted.internet import defer
from twisted.internet.threads import deferToThread
from leap.common.check import leap_assert, leap_assert_type
+from leap.keymanager import openpgp
from leap.soledad import Soledad
-from leap.common.keymanager import openpgp
-
logger = logging.getLogger(__name__)
@@ -67,13 +67,17 @@ class LeapIncomingMail(object):
def _sync_soledad(self):
log.msg('syncing soledad...')
logger.debug('in soledad sync')
- #import ipdb; ipdb.set_trace()
- self._soledad.sync()
- gen, doclist = self._soledad.get_all_docs()
- #logger.debug("there are %s docs" % (len(doclist),))
- log.msg("there are %s docs" % (len(doclist),))
- return doclist
+ try:
+ self._soledad.sync()
+ gen, doclist = self._soledad.get_all_docs()
+ #logger.debug("there are %s docs" % (len(doclist),))
+ log.msg("there are %s docs" % (len(doclist),))
+ return doclist
+ except ssl.SSLError as exc:
+ logger.warning('SSL Error while syncing soledad: %r' % (exc,))
+ except Exception as exc:
+ logger.warning('Error while syncing soledad: %r' % (exc,))
def _sync_soledad_err(self, f):
log.err("error syncing soledad: %s" % (f.value,))
@@ -81,6 +85,8 @@ class LeapIncomingMail(object):
def _process_doclist(self, doclist):
log.msg('processing doclist')
+ if not doclist:
+ return
for doc in doclist:
keys = doc.content.keys()
if self.ENC_SCHEME_KEY in keys and self.ENC_JSON_KEY in keys: