|
11 | 11 | IDAuthor, EmailAddress, IESGLogin, BallotInfo) |
12 | 12 | from ietf.submit.models import TempIdAuthors, IdSubmissionDetail, Preapproval |
13 | 13 | from ietf.utils.mail import send_mail, send_mail_message |
| 14 | +from ietf.utils.log import log |
14 | 15 | from ietf.utils import unaccent |
15 | 16 | from ietf.ietfauth.decorators import has_role |
16 | 17 |
|
@@ -449,8 +450,13 @@ def move_docs(submission): |
449 | 450 | for ext in submission.file_type.split(','): |
450 | 451 | source = os.path.join(settings.IDSUBMIT_STAGING_PATH, '%s-%s%s' % (submission.filename, submission.revision, ext)) |
451 | 452 | 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.") |
454 | 460 |
|
455 | 461 | def remove_docs(submission): |
456 | 462 | for ext in submission.file_type.split(','): |
|
0 commit comments