Commit 618a72e1 authored by Julien Cristau's avatar Julien Cristau
Browse files

return json from import_message

parent 99618c380ad4
......@@ -46,7 +46,7 @@ class Importer(object):
self._import(mailbox.Maildir(path, message_from_file, create=False))
def _import(self, mailbox):
for message in sorted(mailbox, key=lambda x:parsedate(x['Date'])):
for message in sorted(mailbox, key=lambda x: parsedate(x['Date'])):
self.import_message(message)
def import_message(self, message):
......@@ -59,10 +59,14 @@ class Importer(object):
self._alternatives = []
self.import_message_parts(message, emaileid)
try:
self.proxy.rqlio(self._reqs).raise_for_status()
resp = self.proxy.rqlio(self._reqs)
resp.raise_for_status()
except cwproxy.RemoteValidationError as exc:
print("could not import message %s: %s" % (message.get('message-id'), exc.args))
self._reqs = []
else:
return resp.json()
finally:
self._reqs = []
def import_message_parts(self, message, emaileid):
if message.is_multipart():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment