From f36d4e5484e88933a4441ec963b28c1deeeaf20a Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 2 Sep 2012 11:21:21 -0400 Subject: [PATCH] handler:get: sort submission messages chronologically. --- pygrader/handler/get.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pygrader/handler/get.py b/pygrader/handler/get.py index 9a6421c..2aa7d17 100644 --- a/pygrader/handler/get.py +++ b/pygrader/handler/get.py @@ -16,6 +16,7 @@ import pgp_mime as _pgp_mime from .. import LOG as _LOG from ..email import construct_text_email as _construct_text_email from ..email import construct_email as _construct_email +from ..extract_mime import message_time as _message_time from ..storage import assignment_path as _assignment_path from ..tabulate import tabulate as _tabulate from ..template import _student_email as _student_email @@ -430,11 +431,15 @@ def _get_student_submission_email( except _mailbox.NoSuchMailboxError as e: pass else: + messages = [] for key,msg in mbox.items(): subpath = mbox._lookup(key) if subpath.endswith('.gitignore'): _LOG.debug('skipping non-message {}'.format(subpath)) continue + messages.append(msg) + messages.sort(key=_message_time) + for msg in messages: message.attach(_MIMEMessage(msg)) return _construct_email( author=course.robot, targets=[person], subject=subject, -- 2.26.2