diff --git a/ietf/doc/expire.py b/ietf/doc/expire.py index 1650b4ddf52..3f468b559db 100644 --- a/ietf/doc/expire.py +++ b/ietf/doc/expire.py @@ -8,6 +8,7 @@ import datetime, os, shutil, glob, re from pathlib import Path +from zoneinfo import ZoneInfo from typing import List, Optional # pyflakes:ignore @@ -86,10 +87,13 @@ def send_expire_warning_for_draft(doc): (doc.get_state_slug("draft") != "active")): return # don't warn about dead or inactive documents - expiration = doc.expires.astimezone(DEADLINE_TZINFO).date() + expiration = doc.expires.astimezone( + DEADLINE_TZINFO + ).replace( + hour=0, minute=0, second=0, microsecond=0 + ) now_plus_12hours = timezone.now() + datetime.timedelta(hours=12) - soon = now_plus_12hours.date() - if expiration <= soon: + if expiration <= now_plus_12hours: # The document will expire very soon, which will send email to the # same people, so do not send the warning at this point in time return diff --git a/ietf/doc/tests_draft.py b/ietf/doc/tests_draft.py index cc22e221394..78230f73867 100644 --- a/ietf/doc/tests_draft.py +++ b/ietf/doc/tests_draft.py @@ -711,6 +711,7 @@ def test_warn_expirable_drafts(self): self.assertTrue('draft-ietf-mars-test@' in outbox[-1]['To']) # Gets the authors self.assertTrue('mars-chairs@ietf.org' in outbox[-1]['Cc']) self.assertTrue('aread@' in outbox[-1]['Cc']) + self.assertIn('UTC' , get_payload_text(outbox[-1])) # hack into expirable state to expire in 10 hours draft.expires = timezone.now() + datetime.timedelta(hours=10) diff --git a/ietf/templates/doc/draft/expire_warning_email.txt b/ietf/templates/doc/draft/expire_warning_email.txt index d43fadacec3..4b739b15476 100644 --- a/ietf/templates/doc/draft/expire_warning_email.txt +++ b/ietf/templates/doc/draft/expire_warning_email.txt @@ -1,7 +1,7 @@ -{% load ietf_filters %}{% autoescape off %}The following Internet-Draft will expire soon: +{% load ietf_filters tz %}{% autoescape off %}The following Internet-Draft will expire soon: Name: {{ doc.name|clean_whitespace }} Title: {{ doc.title}} State: {{ state }} -Expires: {{ expiration }} (in {{ expiration|timeuntil }}) +Expires: {{ expiration|utc }} (in {{ expiration|timeuntil }}) {% endautoescape %} diff --git a/ietf/templates/notify_expirations/body.txt b/ietf/templates/notify_expirations/body.txt deleted file mode 100644 index e734068bb40..00000000000 --- a/ietf/templates/notify_expirations/body.txt +++ /dev/null @@ -1,7 +0,0 @@ -{% load ietf_filters %}{% autoescape off %}The following Internet-Draft will expire soon: - -Filename: {{draft.filename}} -Title: {{draft.title|clean_whitespace}} -State: {{draft.idstate}} -Expires: {{expiration}} (in {{expiration|timeuntil}}) -{% endautoescape %} diff --git a/ietf/templates/notify_expirations/subject.txt b/ietf/templates/notify_expirations/subject.txt deleted file mode 100644 index 7cb09c178b8..00000000000 --- a/ietf/templates/notify_expirations/subject.txt +++ /dev/null @@ -1 +0,0 @@ -Expiration impending: {{draft.filename}}