Skip to content

Commit 6bc68a9

Browse files
committed
Behave slightly more gracefully if a submission has already been moved into place, and we're asked to do it again.
- Legacy-Id: 4548
1 parent 99a7786 commit 6bc68a9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

ietf/submit/utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
IDAuthor, EmailAddress, IESGLogin, BallotInfo)
1212
from ietf.submit.models import TempIdAuthors, IdSubmissionDetail, Preapproval
1313
from ietf.utils.mail import send_mail, send_mail_message
14+
from ietf.utils.log import log
1415
from ietf.utils import unaccent
1516
from ietf.ietfauth.decorators import has_role
1617

@@ -449,8 +450,13 @@ def move_docs(submission):
449450
for ext in submission.file_type.split(','):
450451
source = os.path.join(settings.IDSUBMIT_STAGING_PATH, '%s-%s%s' % (submission.filename, submission.revision, ext))
451452
dest = os.path.join(settings.IDSUBMIT_REPOSITORY_PATH, '%s-%s%s' % (submission.filename, submission.revision, ext))
452-
os.rename(source, dest)
453-
453+
if os.path.exists(source):
454+
os.rename(source, dest)
455+
else:
456+
if os.path.exists(dest):
457+
log("Intended to move '%s' to '%s', but found source missing while destination exists.", send_mail=True)
458+
else:
459+
raise ValueError("Intended to move '%s' to '%s', but found source and destination missing.")
454460

455461
def remove_docs(submission):
456462
for ext in submission.file_type.split(','):

0 commit comments

Comments
 (0)