Skip to content
Snippets Groups Projects
Commit 71597a2d8d9c authored by David Douard's avatar David Douard
Browse files

[mboximport] import the mail box messages sorted by date (closes #2515093)

This is required since the EmailThread creation logic strongly rely on the order which Email entities are created
parent 277d815fe802
No related branches found
No related tags found
No related merge requests found
......@@ -64,5 +64,6 @@
self.skipped.append(messageid)
def import_mbox_stream(self, stream):
from mailbox import UnixMailbox
from mailbox import UnixMailbox as Mailbox
from rfc822 import parsedate
from logilab.common.umessage import message_from_file
......@@ -68,5 +69,6 @@
from logilab.common.umessage import message_from_file
for message in UnixMailbox(stream, message_from_file):
for message in sorted(Mailbox(stream, message_from_file),
key=lambda x:parsedate(x['Date'])):
try:
self.import_message(message)
if self.autocommit:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment