Skip to content

Commit 289d9eb

Browse files
committed
Moved some path checks from SubmissionUploadForm to the ietf/checks.py.
- Legacy-Id: 10753
1 parent 041532d commit 289d9eb

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

ietf/checks.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,32 @@ def check_doc_email_aliases_exists(app_configs, **kwargs):
6767

6868
return errors
6969

70+
@checks.register('directories')
71+
def check_id_submission_directories(app_configs, **kwargs):
72+
errors = []
73+
for s in ("IDSUBMIT_STAGING_PATH", "IDSUBMIT_REPOSITORY_PATH", "INTERNET_DRAFT_ARCHIVE_DIR"):
74+
p = getattr(settings, s)
75+
if not os.path.exists(p):
76+
errors.append(checks.Critical(
77+
"A directory used by the ID submission tool does not exist at the path given\n"
78+
"in the settings file. The setting is:\n"
79+
" %s = %s" % (s, p),
80+
hint = ("Please either update the local settings to point at the correct directory,"
81+
"or if the setting is correct, create the directory."),
82+
id = "datatracker.E0006",
83+
))
84+
85+
@checks.register('files')
86+
def check_id_submission_directories(app_configs, **kwargs):
87+
errors = []
88+
for s in ("IDSUBMIT_IDNITS_BINARY", ):
89+
p = getattr(settings, s)
90+
if not os.path.exists(p):
91+
errors.append(checks.Critical(
92+
"A file used by the ID submission tool does not exist at the path given\n"
93+
"in the settings file. The setting is:\n"
94+
" %s = %s" % (s, p),
95+
hint = ("Please either update the local settings to point at the correct file,"
96+
"or if the setting is correct, make sure the file is in place and has the right permissions."),
97+
id = "datatracker.E0007",
98+
))

ietf/submit/forms.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,6 @@ def clean(self):
118118
if self.shutdown and not has_role(self.request.user, "Secretariat"):
119119
raise forms.ValidationError('The submission tool is currently shut down')
120120

121-
# sanity check that paths exist (for development servers)
122-
for s in ("IDSUBMIT_STAGING_PATH", "IDSUBMIT_IDNITS_BINARY",
123-
"IDSUBMIT_REPOSITORY_PATH", "INTERNET_DRAFT_ARCHIVE_DIR"):
124-
if not os.path.exists(getattr(settings, s)):
125-
raise forms.ValidationError('%s defined in settings.py does not exist' % s)
126-
127121
for ext in ['txt', 'pdf', 'xml', 'ps']:
128122
f = self.cleaned_data.get(ext, None)
129123
if not f:

0 commit comments

Comments
 (0)