pg.py|mailpipe: add --trust-email-infrastructure.
authorW. Trevor King <wking@tremily.us>
Sun, 2 Sep 2012 13:33:57 +0000 (09:33 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 2 Sep 2012 13:33:57 +0000 (09:33 -0400)
bin/pg.py
pygrader/mailpipe.py

index 6832dd300e403ce92519b2df84965f17f3866595..da00e1fc69619055af366b085aee723c758b726b 100755 (executable)
--- a/bin/pg.py
+++ b/bin/pg.py
@@ -142,6 +142,11 @@ if __name__ == '__main__':
         '-r', '--respond', default=False, action='store_const', const=True,
         help=('Send automatic response emails to acknowledge incoming '
               'messages.'))
+    mailpipe_parser.add_argument(
+        '-t', '--trust-email-infrastructure',
+        default=False, action='store_const', const=True,
+        help=('Send automatic response emails even if the target has not '
+              'registered a PGP key.'))
 
     todo_parser = subparsers.add_parser(
         'todo', help=_todo.__doc__.splitlines()[0])
@@ -198,7 +203,7 @@ if __name__ == '__main__':
                     else:
                         kwargs[attr].extend(course.find_people(name=person))
         for attr in ['dry_run', 'mailbox', 'output', 'input_', 'max_late',
-                     'old', 'statistics']:
+                     'old', 'statistics', 'trust_email_infrastructure']:
             if hasattr(args, attr):
                 kwargs[attr] = getattr(args, attr)
     elif args.func == _test_smtp:
index 6c832f0b8e2715f4c582b2719da7d4abfcadd97f..f704cb33d758263d7f032edaefeeb5b72ffe11d6 100644 (file)
@@ -89,6 +89,7 @@ class InvalidHandlerMessage (_InvalidSubjectMessage):
 
 def mailpipe(basedir, course, stream=None, mailbox=None, input_=None,
              output=None, continue_after_invalid_message=False, max_late=0,
+             trust_email_infrastructure=False,
              handlers={
         'get': _handle_get,
         'submit': _handle_submission,
@@ -561,7 +562,9 @@ def mailpipe(basedir, course, stream=None, mailbox=None, input_=None,
             handler(
                 basedir=basedir, course=course, message=message,
                 person=person, subject=subject,
-                max_late=max_late, dry_run=dry_run)
+                max_late=max_late,
+                trust_email_infrastructure=trust_email_infrastructure,
+                dry_run=dry_run)
         except _InvalidMessage as error:
             error.course = course
             error.message = original