mailpipe: respond with the fleshed out message, not the original.
authorW. Trevor King <wking@tremily.us>
Sun, 2 Sep 2012 14:22:26 +0000 (10:22 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 2 Sep 2012 14:22:26 +0000 (10:22 -0400)
We've just added an author, targets, subject, etc.  None of that
matters if you send the original version.

Also print check that the subject is not None before we remove any
subject fields.  This shouldn't matter (del-ing a None subject should
be a no-op), but it seems safer to print the offending message before
messing with it.

pygrader/mailpipe.py

index 1cd3f90d3365939fc7fb05009187d97bed71650a..fa01d988e090dc64e5144e2b7419ab7d8560195e 100644 (file)
@@ -625,12 +625,12 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None,
                         del msg['content-transfer-encoding']
                     msg.set_payload(new_payload, new_encoding)
                 subject = msg['Subject']
-                del msg['Subject']
                 assert subject is not None, msg
+                del msg['Subject']
                 msg = _construct_email(
                     author=author, targets=[person], subject=subject,
                     message=msg)
-                respond(response.message)
+                respond(msg)
 
 
 def _load_messages(course, stream, mailbox=None, input_=None, output=None,