Skip to content

Commit e46220a

Browse files
committed
Added code to expire last calls for statechg documents too (in addition to iesg drafts) with the expire-last-call script. Fixes issue ietf-tools#1092.
- Legacy-Id: 6044
1 parent 4376c7d commit e46220a

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

ietf/idrfc/lastcall.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import datetime
44

55
from django.conf import settings
6+
from django.db.models import Q
67

78
from ietf.idtracker.models import InternetDraft, DocumentComment, BallotInfo
89
from ietf.idrfc.mails import *
910
from ietf.idrfc.utils import *
10-
1111
from ietf.doc.models import *
1212
from ietf.person.models import Person
1313

14+
import debug
15+
1416
def request_last_call(request, doc):
1517
try:
1618
ballot = doc.idinternal.ballot
@@ -46,7 +48,8 @@ def get_expired_last_calls():
4648

4749
def get_expired_last_callsREDESIGN():
4850
today = datetime.date.today()
49-
for d in Document.objects.filter(states__type="draft-iesg", states__slug="lc"):
51+
for d in Document.objects.filter(Q(states__type="draft-iesg", states__slug="lc")
52+
| Q(states__type="statchg", states__slug="in-lc")):
5053
e = d.latest_event(LastCallDocEvent, type="sent_last_call")
5154
if e and e.expires.date() <= today:
5255
yield d
@@ -70,17 +73,22 @@ def expire_last_call(doc):
7073
email_last_call_expired(doc)
7174

7275
def expire_last_callREDESIGN(doc):
73-
state = State.objects.get(used=True, type="draft-iesg", slug="writeupw")
74-
75-
e = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
76-
if e and "Relevant content can frequently be found in the abstract" not in e.text:
77-
# if boiler-plate text has been removed, we assume the
78-
# write-up has been written
79-
state = State.objects.get(used=True, type="draft-iesg", slug="goaheadw")
76+
if doc.type_id == 'draft':
77+
state = State.objects.get(used=True, type="draft-iesg", slug="writeupw")
78+
e = doc.latest_event(WriteupDocEvent, type="changed_ballot_writeup_text")
79+
if e and "Relevant content can frequently be found in the abstract" not in e.text:
80+
# if boiler-plate text has been removed, we assume the
81+
# write-up has been written
82+
state = State.objects.get(used=True, type="draft-iesg", slug="goaheadw")
83+
prev = doc.get_state("draft-iesg")
84+
elif doc.type_id == 'statchg':
85+
state = State.objects.get(used=True, type="statchg", slug="goahead")
86+
prev = doc.get_state("statchg")
87+
else:
88+
raise ValueError("Unexpected document type to expire_last_call(): %s" % doc.type)
8089

8190
save_document_in_history(doc)
8291

83-
prev = doc.get_state("draft-iesg")
8492
doc.set_state(state)
8593

8694
prev_tag = doc.tags.filter(slug__in=IESG_SUBSTATE_TAGS)
@@ -89,7 +97,7 @@ def expire_last_callREDESIGN(doc):
8997
doc.tags.remove(prev_tag)
9098

9199
e = log_state_changed(None, doc, Person.objects.get(name="(System)"), prev, prev_tag)
92-
100+
93101
doc.time = e.time
94102
doc.save()
95103

0 commit comments

Comments
 (0)