@@ -21,23 +21,29 @@ def expirable_draft(draft):
2121 if draft .type_id != 'draft' :
2222 return False
2323 log .assertion ('draft.get_state_slug("draft-iesg")' )
24- return (draft .expires and draft .get_state_slug () == "active"
25- and draft .get_state_slug ("draft-iesg" ) in ("idexists" , "watching" , "dead" )
26- and draft .get_state_slug ("draft-stream-%s" % draft .stream_id ) not in ("rfc-edit" , "pub" )
27- and not draft .tags .filter (slug = "rfc-rev" ))
24+ # return (draft.expires and draft.get_state_slug() == "active"
25+ # and draft.get_state_slug("draft-iesg") in ("idexists", "watching", "dead")
26+ # and draft.get_state_slug("draft-stream-%s" % draft.stream_id) not in ("rfc-edit", "pub")
27+ # and not draft.tags.filter(slug="rfc-rev"))
28+ return bool (expirable_drafts (Document .objects .filter (pk = draft .pk )))
2829
29- def expirable_drafts ():
30+ def expirable_drafts (queryset = None ):
3031 """Return a queryset with expirable drafts."""
3132 # the general rule is that each active draft is expirable, unless
3233 # it's in a state where we shouldn't touch it
33- d = Document .objects .filter (states__type = "draft" , states__slug = "active" ).exclude (expires = None )
34+ if not queryset :
35+ queryset = Document .objects .all ()
36+
37+ d = queryset .filter (states__type = "draft" , states__slug = "active" ).exclude (expires = None )
3438
3539 nonexpirable_states = []
3640 # all IESG states except I-D Exists, AD Watching, and Dead block expiry
3741 nonexpirable_states += list (State .objects .filter (used = True , type = "draft-iesg" ).exclude (slug__in = ("idexists" ,"watching" , "dead" )))
3842 # sent to RFC Editor and RFC Published block expiry (the latter
3943 # shouldn't be possible for an active draft, though)
4044 nonexpirable_states += list (State .objects .filter (used = True , type__in = ("draft-stream-iab" , "draft-stream-irtf" , "draft-stream-ise" ), slug__in = ("rfc-edit" , "pub" )))
45+ # other IRTF states that block expiration
46+ nonexpirable_states += list (State .objects .filter (used = True , type_id = "draft-stream-irtf" , slug__in = ("irsgpoll" , "iesg-rev" ,)))
4147
4248 d = d .exclude (states__in = nonexpirable_states )
4349
0 commit comments