handler:get: skip .gitignore messages a la mailpipe._load_messages.
authorW. Trevor King <wking@tremily.us>
Sun, 2 Sep 2012 15:16:12 +0000 (11:16 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 2 Sep 2012 15:16:12 +0000 (11:16 -0400)
pygrader/handler/get.py

index 24d79c4e3182a10242a499463619c98a2397b57f..9a6421c2eecf2ac254e556114ad9c53114d46d52 100644 (file)
@@ -430,7 +430,11 @@ def _get_student_submission_email(
         except _mailbox.NoSuchMailboxError as e:
             pass
         else:
-            for msg in mbox:
+            for key,msg in mbox.items():
+                subpath = mbox._lookup(key)
+                if subpath.endswith('.gitignore'):
+                    _LOG.debug('skipping non-message {}'.format(subpath))
+                    continue
                 message.attach(_MIMEMessage(msg))
     return _construct_email(
         author=course.robot, targets=[person], subject=subject,