66
77import datetime , os , shutil , glob , re , itertools
88
9- from ietf .idtracker .models import InternetDraft , IDDates , IDStatus , IDState , DocumentComment , IDAuthor ,WGChair
9+ from ietf .idtracker .models import InternetDraft , IDDates , IDStatus , IDState , DocumentComment , IDAuthor , WGChair
1010from ietf .utils .mail import send_mail , send_mail_subj
1111from ietf .idrfc .utils import log_state_changed , add_document_comment
1212from redesign .doc .models import Document , DocEvent , save_document_in_history , State
@@ -154,7 +154,7 @@ def send_expire_notice_for_idREDESIGN(doc):
154154
155155def expire_id (doc ):
156156 def move_file (f ):
157- src = os .path .join (settings .IDSUBMIT_REPOSITORY_PATH , f )
157+ src = os .path .join (settings .INTERNET_DRAFT_PATH , f )
158158 dst = os .path .join (settings .INTERNET_DRAFT_ARCHIVE_DIR , f )
159159
160160 if os .path .exists (src ):
@@ -167,7 +167,7 @@ def move_file(f):
167167
168168 new_revision = "%02d" % (int (doc .revision ) + 1 )
169169
170- new_file = open (os .path .join (settings .IDSUBMIT_REPOSITORY_PATH , "%s-%s.txt" % (doc .filename , new_revision )), 'w' )
170+ new_file = open (os .path .join (settings .INTERNET_DRAFT_PATH , "%s-%s.txt" % (doc .filename , new_revision )), 'w' )
171171 txt = render_to_string ("idrfc/expire_text.txt" ,
172172 dict (doc = doc ,
173173 authors = [a .person .email () for a in doc .authors .all ()],
@@ -188,23 +188,25 @@ def move_file(f):
188188
189189 add_document_comment (None , doc , "Document is expired by system" )
190190
191- def expire_idREDESIGN (doc ):
192- system = Person .objects .get (name = "(System)" )
193-
194- # clean up files
191+ def move_draft_files_to_archive (doc , rev ):
195192 def move_file (f ):
196- src = os .path .join (settings .IDSUBMIT_REPOSITORY_PATH , f )
193+ src = os .path .join (settings .INTERNET_DRAFT_PATH , f )
197194 dst = os .path .join (settings .INTERNET_DRAFT_ARCHIVE_DIR , f )
198195
199196 if os .path .exists (src ):
200197 shutil .move (src , dst )
201198
202199 file_types = ['txt' , 'txt.p7s' , 'ps' , 'pdf' ]
203200 for t in file_types :
204- move_file ("%s-%s.%s" % (doc .name , doc .rev , t ))
201+ move_file ("%s-%s.%s" % (doc .name , rev , t ))
202+
203+ def expire_idREDESIGN (doc ):
204+ # clean up files
205+ move_draft_files_to_archive (doc , doc .rev )
206+
207+ # change the state
208+ system = Person .objects .get (name = "(System)" )
205209
206- # now change the state
207-
208210 save_document_in_history (doc )
209211 if doc .latest_event (type = 'started_iesg_process' ):
210212 dead_state = State .objects .get (type = "draft-iesg" , slug = "dead" )
@@ -230,7 +232,7 @@ def clean_up_id_files():
230232 """Move unidentified and old files out of the Internet Draft directory."""
231233 cut_off = datetime .date .today () - datetime .timedelta (days = InternetDraft .DAYS_TO_EXPIRE )
232234
233- pattern = os .path .join (settings .IDSUBMIT_REPOSITORY_PATH , "draft-*.*" )
235+ pattern = os .path .join (settings .INTERNET_DRAFT_PATH , "draft-*.*" )
234236 files = []
235237 filename_re = re .compile ('^(.*)-(\d\d)$' )
236238
@@ -290,7 +292,7 @@ def clean_up_id_filesREDESIGN():
290292 """Move unidentified and old files out of the Internet Draft directory."""
291293 cut_off = datetime .date .today ()
292294
293- pattern = os .path .join (settings .IDSUBMIT_REPOSITORY_PATH , "draft-*.*" )
295+ pattern = os .path .join (settings .INTERNET_DRAFT_PATH , "draft-*.*" )
294296 files = []
295297 filename_re = re .compile ('^(.*)-(\d\d)$' )
296298
0 commit comments