Peret checks PGP signed mails and extract submissions
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
826 B

from datetime import datetime, timezone
from test import MailTest
def check(cnt, hard_max_submission_date, soft_max_submission_date=None):
if soft_max_submission_date is None:
soft_max_submission_date = hard_max_submission_date
soft_max_submission_date = min(soft_max_submission_date, hard_max_submission_date)
now =
yield MailTest("We are %s, submission permitted until %s" % (now.strftime("%c"), soft_max_submission_date.strftime("%c")), -1)
if now > soft_max_submission_date:
discard = now > hard_max_submission_date
yield MailTest("Submissions have been closed since %s minute(s)" % int((now - soft_max_submission_date).total_seconds()/60), 1 if discard else 2)
if discard:
yield cnt