forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanualpost_email.py
More file actions
32 lines (22 loc) · 856 Bytes
/
manualpost_email.py
File metadata and controls
32 lines (22 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Copyright The IETF Trust 2016-2020, All Rights Reserved
# -*- coding: utf-8 -*-
import io
import sys
from django.core.management.base import BaseCommand, CommandError
from ietf.submit.mail import process_response_email
import debug # pyflakes:ignore
class Command(BaseCommand):
help = ("Process incoming manual post email responses")
def add_arguments(self, parser):
parser.add_argument('--email-file', dest='email', help='File containing email (default: stdin)')
def handle(self, *args, **options):
email = options.get('email', None)
msg = None
if not email:
msg = sys.stdin.read()
else:
msg = io.open(email, "r").read()
try:
process_response_email(msg)
except ValueError as e:
raise CommandError(e)