Changed the code to move drafts from the active draft repository to the draft archive so that all associated files will be moved, not just those with specifically listed extensions. This fixes the problem that .xml files associated with submitted drafts were moved to the unknown_ids subdirectory of the archive, instead of into the archive proper.

- Legacy-Id: 7922
This commit is contained in:
Henrik Levkowetz 2014-06-16 16:23:18 +00:00
parent a71335af14
commit a03ee6b333

View file

@ -9,6 +9,10 @@ from ietf.doc.models import Document, DocEvent, State, save_document_in_history,
from ietf.person.models import Person, Email
from ietf.meeting.models import Meeting
from ietf.doc.utils import add_state_change_event
try:
from pathlib import Path
except ImportError:
from ietf.utils.path import path as Path
def expirable_draft(draft):
"""Return whether draft is in an expirable state or not. This is
@ -112,9 +116,9 @@ def move_draft_files_to_archive(doc, rev):
if os.path.exists(src):
shutil.move(src, dst)
file_types = ['txt', 'txt.p7s', 'ps', 'pdf']
for t in file_types:
move_file("%s-%s.%s" % (doc.name, rev, t))
src_dir = Path(settings.INTERNET_DRAFT_PATH)
for file in src_dir.glob("%s-%s.*" % (doc.name, rev)):
move_file(str(file.name))
def expire_draft(doc):
# clean up files