Skip to content

Commit 71b1f13

Browse files
authored
fix: improfe draft name syntax checks (ietf-tools#3703)
* fix: Include blocked charters in AD dashboard that are ub external review * fix: Improve draft name syntax checks. Fixes ietf-tools#3677
1 parent 5c5d052 commit 71b1f13

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

ietf/doc/views_search.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ def docs_for_ad(request, name):
447447
if blocked_docs:
448448
blocked_docs.sort(key=lambda d: min(p.time for p in d.blocking_positions if p.balloter==ad), reverse=True)
449449

450+
for d in blocked_docs:
451+
if d.get_base_name() == 'charter-ietf-shmoo-01-04.txt':
452+
print('Is in list')
453+
450454
return render(request, 'doc/drafts_for_ad.html', {
451455
'form':form, 'docs':results, 'meta':meta, 'ad_name': ad.plain_name(), 'blocked_docs': blocked_docs
452456
})

ietf/submit/forms.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -567,19 +567,15 @@ class PreapprovalForm(forms.Form):
567567

568568
def clean_name(self):
569569
n = self.cleaned_data['name'].strip().lower()
570-
571-
if not n.startswith("draft-"):
572-
raise forms.ValidationError("Name doesn't start with \"draft-\".")
573-
if len(n.split(".")) > 1 and len(n.split(".")[-1]) == 3:
574-
raise forms.ValidationError("Name appears to end with a file extension .%s - do not include an extension." % n.split(".")[-1])
570+
error_msg = validate_submission_name(n)
571+
if error_msg:
572+
raise forms.ValidationError(error_msg)
575573

576574
components = n.split("-")
577575
if components[-1] == "00":
578576
raise forms.ValidationError("Name appears to end with a revision number -00 - do not include the revision.")
579577
if len(components) < 4:
580578
raise forms.ValidationError("Name has less than four dash-delimited components - can't form a valid group draft name.")
581-
if not components[-1]:
582-
raise forms.ValidationError("Name ends with a dash.")
583579
acronym = components[2]
584580
if acronym not in [ g.acronym for g in self.groups ]:
585581
raise forms.ValidationError("Group acronym not recognized as one you can approve drafts for.")

ietf/submit/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ def validate_submission_name(name):
127127
return msg
128128
return None
129129

130+
components = name.split('-')
131+
if '' in components:
132+
return "Name contains adjacent dashes or the name ends with a dash."
133+
if len(components) < 3:
134+
return "Name has less than three dash-delimited components in the name."
135+
130136
def validate_submission_rev(name, rev):
131137
if not rev:
132138
return 'Revision not found'

0 commit comments

Comments
 (0)