fix: improfe draft name syntax checks (#3703)
* fix: Include blocked charters in AD dashboard that are ub external review * fix: Improve draft name syntax checks. Fixes #3677
This commit is contained in:
parent
5c5d052603
commit
71b1f13a79
|
@ -447,6 +447,10 @@ def docs_for_ad(request, name):
|
|||
if blocked_docs:
|
||||
blocked_docs.sort(key=lambda d: min(p.time for p in d.blocking_positions if p.balloter==ad), reverse=True)
|
||||
|
||||
for d in blocked_docs:
|
||||
if d.get_base_name() == 'charter-ietf-shmoo-01-04.txt':
|
||||
print('Is in list')
|
||||
|
||||
return render(request, 'doc/drafts_for_ad.html', {
|
||||
'form':form, 'docs':results, 'meta':meta, 'ad_name': ad.plain_name(), 'blocked_docs': blocked_docs
|
||||
})
|
||||
|
|
|
@ -567,19 +567,15 @@ class PreapprovalForm(forms.Form):
|
|||
|
||||
def clean_name(self):
|
||||
n = self.cleaned_data['name'].strip().lower()
|
||||
|
||||
if not n.startswith("draft-"):
|
||||
raise forms.ValidationError("Name doesn't start with \"draft-\".")
|
||||
if len(n.split(".")) > 1 and len(n.split(".")[-1]) == 3:
|
||||
raise forms.ValidationError("Name appears to end with a file extension .%s - do not include an extension." % n.split(".")[-1])
|
||||
error_msg = validate_submission_name(n)
|
||||
if error_msg:
|
||||
raise forms.ValidationError(error_msg)
|
||||
|
||||
components = n.split("-")
|
||||
if components[-1] == "00":
|
||||
raise forms.ValidationError("Name appears to end with a revision number -00 - do not include the revision.")
|
||||
if len(components) < 4:
|
||||
raise forms.ValidationError("Name has less than four dash-delimited components - can't form a valid group draft name.")
|
||||
if not components[-1]:
|
||||
raise forms.ValidationError("Name ends with a dash.")
|
||||
acronym = components[2]
|
||||
if acronym not in [ g.acronym for g in self.groups ]:
|
||||
raise forms.ValidationError("Group acronym not recognized as one you can approve drafts for.")
|
||||
|
|
|
@ -127,6 +127,12 @@ def validate_submission_name(name):
|
|||
return msg
|
||||
return None
|
||||
|
||||
components = name.split('-')
|
||||
if '' in components:
|
||||
return "Name contains adjacent dashes or the name ends with a dash."
|
||||
if len(components) < 3:
|
||||
return "Name has less than three dash-delimited components in the name."
|
||||
|
||||
def validate_submission_rev(name, rev):
|
||||
if not rev:
|
||||
return 'Revision not found'
|
||||
|
|
Loading…
Reference in a new issue