Skip to content

Commit 9f29264

Browse files
committed
Fixes ticket:1164 simplified clean_up_draft_files(). removed references to old draft-archive subdirectories, and fixed for all RFC file types
- Legacy-Id: 7378
1 parent df97de8 commit 9f29264

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

ietf/doc/expire.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ def in_draft_expire_freeze(when=None):
5757
d = Meeting.get_second_cut_off()
5858
# for some reason, the old Perl code started at 9 am
5959
second_cut_off = datetime.datetime.combine(d, datetime.time(9, 0))
60-
60+
6161
d = Meeting.get_ietf_monday()
6262
ietf_monday = datetime.datetime.combine(d, datetime.time(0, 0))
63-
63+
6464
return second_cut_off <= when < ietf_monday
6565

6666
def send_expire_warning_for_draft(doc):
@@ -76,7 +76,7 @@ def send_expire_warning_for_draft(doc):
7676

7777
s = doc.get_state("draft-iesg")
7878
state = s.name if s else "I-D Exists"
79-
79+
8080
frm = None
8181
request = None
8282
if to or cc:
@@ -151,7 +151,7 @@ def clean_up_draft_files():
151151
pattern = os.path.join(settings.INTERNET_DRAFT_PATH, "draft-*.*")
152152
files = []
153153
filename_re = re.compile('^(.*)-(\d\d)$')
154-
154+
155155
def splitext(fn):
156156
"""
157157
Split the pathname path into a pair (root, ext) such that root + ext
@@ -182,23 +182,16 @@ def splitext(fn):
182182
def move_file_to(subdir):
183183
shutil.move(path,
184184
os.path.join(settings.INTERNET_DRAFT_ARCHIVE_DIR, subdir, basename))
185-
185+
186186
try:
187187
doc = Document.objects.get(name=filename, rev=revision)
188188

189189
state = doc.get_state_slug()
190190

191-
if state == "rfc":
192-
if ext != ".txt":
193-
move_file_to("unknown_ids")
194-
elif state in ("expired", "repl", "auth-rm", "ietf-rm") and doc.expires and doc.expires.date() < cut_off:
195-
# Expired, Replaced, Withdrawn by Author/IETF, and expired
196-
if os.path.getsize(path) < 1500:
197-
# we don't make tombstones any more so this should
198-
# go away in the future
199-
move_file_to("deleted_tombstones")
200-
else:
201-
move_file_to("expired_without_tombstone")
202-
191+
if state in ("rfc","repl"):
192+
move_file_to("")
193+
elif state in ("expired", "auth-rm", "ietf-rm") and doc.expires and doc.expires.date() < cut_off:
194+
move_file_to("")
195+
203196
except Document.DoesNotExist:
204197
move_file_to("unknown_ids")

0 commit comments

Comments
 (0)