Merged in [9875] from rjsparks@nostrum.com:
Improve the form validation for the submission replaces form.
- Legacy-Id: 9877
Note: SVN reference [9875] has been migrated to Git commit 766270a344
This commit is contained in:
commit
ea26114076
52
changelog
52
changelog
|
@ -1,3 +1,55 @@
|
||||||
|
ietfdb (6.2.0) ietf; urgency=medium
|
||||||
|
|
||||||
|
**XML-Only Draft Submission**
|
||||||
|
|
||||||
|
This release adds draft submission metadata extraction from xml files, if
|
||||||
|
they are made part of a draft submission, and it permits submission of only
|
||||||
|
draft XML files without an accompanying text file, as long as conversion of the
|
||||||
|
submitted XML to text format succeeds. The release also contains numerous
|
||||||
|
style, text and bug fixes from Lars Eggert, and improvements to the ability to
|
||||||
|
accept draft replacement information at drafts submission time.
|
||||||
|
|
||||||
|
* Merged in [9875] from rjsparks@nostrum.com:
|
||||||
|
Improved the form validation for the submission replaces form. Commit
|
||||||
|
ready for merge.
|
||||||
|
|
||||||
|
* Merged in [9862] from rjsparks@nostrum.com:
|
||||||
|
Ignore suggestions that a draft replaces itself.
|
||||||
|
|
||||||
|
* Merged in [9849] from lars@netapp.com:
|
||||||
|
Made nav title capitalization consistent with other text. Consistently
|
||||||
|
add arrows for tabs that navigate away from the site. Shorten some text.
|
||||||
|
|
||||||
|
* Merged in [9857] from lars@netapp.com:
|
||||||
|
Applied more of the styling from the current meta tables.
|
||||||
|
|
||||||
|
* Merged in [9856] from lars@netapp.com:
|
||||||
|
Styled the metadata tables for groups, documents, etc. like Henrik
|
||||||
|
prefers.
|
||||||
|
|
||||||
|
* Merged in [9855] from lars@netapp.com:
|
||||||
|
Fixed bugs in adding/removing documents to personal ID list.
|
||||||
|
|
||||||
|
* Merged in [9852] from lars@netapp.com:
|
||||||
|
Fixed display of AD and shepherd names, and also fix the respective
|
||||||
|
mailto: links.
|
||||||
|
|
||||||
|
* Merged in [9851] from lars@netapp.com:
|
||||||
|
Fixed the logic, so that if there are no matches and we don't want a warning
|
||||||
|
saying that, there is also no empty table being produced.
|
||||||
|
|
||||||
|
* Merged in [9850] from lars@netapp.com:
|
||||||
|
Moved state length notification after RFC Editor status (looks better).
|
||||||
|
|
||||||
|
* Merged in support of xml-source only drafts submissions from
|
||||||
|
personal/henrik/submitxml/.
|
||||||
|
|
||||||
|
* Merged in [9843] from lars@netapp.com:
|
||||||
|
Converted two remaining protocol-relative URLs to https.
|
||||||
|
|
||||||
|
-- Henrik Levkowetz <henrik@levkowetz.com> 23 Jul 2015 05:08:02 -0700
|
||||||
|
|
||||||
|
|
||||||
ietfdb (6.1.0) ietf; urgency=medium
|
ietfdb (6.1.0) ietf; urgency=medium
|
||||||
|
|
||||||
**IETF 93 Code Sprint**
|
**IETF 93 Code Sprint**
|
||||||
|
|
|
@ -325,6 +325,22 @@ class NameEmailForm(forms.Form):
|
||||||
class ReplacesForm(forms.Form):
|
class ReplacesForm(forms.Form):
|
||||||
replaces = SearchableDocAliasesField(required=False, help_text="Any drafts that this document replaces (approval required for replacing a draft you are not the author of)")
|
replaces = SearchableDocAliasesField(required=False, help_text="Any drafts that this document replaces (approval required for replacing a draft you are not the author of)")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self.name = kwargs.pop("name")
|
||||||
|
super(ReplacesForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def clean_replaces(self):
|
||||||
|
for alias in self.cleaned_data['replaces']:
|
||||||
|
if alias.document.name == self.name:
|
||||||
|
raise forms.ValidationError("A draft cannot replace itself.")
|
||||||
|
if alias.document.type_id != "draft":
|
||||||
|
raise forms.ValidationError("A draft can only replace another draft")
|
||||||
|
if alias.document.get_state_slug() == "rfc":
|
||||||
|
raise forms.ValidationError("A draft cannot replace an RFC")
|
||||||
|
if alias.document.get_state_slug('draft-iesg') in ('approved','ann','rfcqueue'):
|
||||||
|
raise forms.ValidationError(alias.name+" is approved by the IESG and cannot be replaced")
|
||||||
|
return self.cleaned_data['replaces']
|
||||||
|
|
||||||
class EditSubmissionForm(forms.ModelForm):
|
class EditSubmissionForm(forms.ModelForm):
|
||||||
title = forms.CharField(required=True, max_length=255)
|
title = forms.CharField(required=True, max_length=255)
|
||||||
rev = forms.CharField(label=u'Revision', max_length=2, required=True)
|
rev = forms.CharField(label=u'Revision', max_length=2, required=True)
|
||||||
|
|
|
@ -113,9 +113,10 @@ class SubmitTests(TestCase):
|
||||||
"replaces": replaces,
|
"replaces": replaces,
|
||||||
})
|
})
|
||||||
|
|
||||||
submission = Submission.objects.get(name=name)
|
if r.status_code == 302:
|
||||||
self.assertEqual(submission.submitter, u"%s <%s>" % (submitter_name, submitter_email))
|
submission = Submission.objects.get(name=name)
|
||||||
self.assertEqual(submission.replaces, ",".join(d.name for d in DocAlias.objects.filter(pk__in=replaces.split(",") if replaces else [])))
|
self.assertEqual(submission.submitter, u"%s <%s>" % (submitter_name, submitter_email))
|
||||||
|
self.assertEqual(submission.replaces, ",".join(d.name for d in DocAlias.objects.filter(pk__in=replaces.split(",") if replaces else [])))
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
@ -396,7 +397,7 @@ class SubmitTests(TestCase):
|
||||||
def test_submit_new_individual_txt_xml(self):
|
def test_submit_new_individual_txt_xml(self):
|
||||||
self.submit_new_individual(["txt", "xml"])
|
self.submit_new_individual(["txt", "xml"])
|
||||||
|
|
||||||
def test_submit_update_replacing_self(self):
|
def test_submit_update_individual(self):
|
||||||
draft = make_test_data()
|
draft = make_test_data()
|
||||||
name = draft.name
|
name = draft.name
|
||||||
rev = '%02d'%(int(draft.rev)+1)
|
rev = '%02d'%(int(draft.rev)+1)
|
||||||
|
@ -404,6 +405,18 @@ class SubmitTests(TestCase):
|
||||||
mailbox_before = len(outbox)
|
mailbox_before = len(outbox)
|
||||||
replaced_alias = draft.docalias_set.first()
|
replaced_alias = draft.docalias_set.first()
|
||||||
r = self.supply_extra_metadata(name, status_url, "Submitter Name", "author@example.com", replaces=str(replaced_alias.pk))
|
r = self.supply_extra_metadata(name, status_url, "Submitter Name", "author@example.com", replaces=str(replaced_alias.pk))
|
||||||
|
self.assertEqual(r.status_code, 200)
|
||||||
|
self.assertTrue('cannot replace itself' in r.content)
|
||||||
|
replaced_alias = DocAlias.objects.get(name='draft-ietf-random-thing')
|
||||||
|
r = self.supply_extra_metadata(name, status_url, "Submitter Name", "author@example.com", replaces=str(replaced_alias.pk))
|
||||||
|
self.assertEqual(r.status_code, 200)
|
||||||
|
self.assertTrue('cannot replace an RFC' in r.content)
|
||||||
|
replaced_alias.document.set_state(State.objects.get(type='draft-iesg',slug='approved'))
|
||||||
|
replaced_alias.document.set_state(State.objects.get(type='draft',slug='active'))
|
||||||
|
r = self.supply_extra_metadata(name, status_url, "Submitter Name", "author@example.com", replaces=str(replaced_alias.pk))
|
||||||
|
self.assertEqual(r.status_code, 200)
|
||||||
|
self.assertTrue('approved by the IESG and cannot' in r.content)
|
||||||
|
r = self.supply_extra_metadata(name, status_url, "Submitter Name", "author@example.com", replaces='')
|
||||||
self.assertEqual(r.status_code, 302)
|
self.assertEqual(r.status_code, 302)
|
||||||
status_url = r["Location"]
|
status_url = r["Location"]
|
||||||
r = self.client.get(status_url)
|
r = self.client.get(status_url)
|
||||||
|
|
|
@ -199,7 +199,7 @@ def submission_status(request, submission_id, access_token=None):
|
||||||
|
|
||||||
|
|
||||||
submitter_form = NameEmailForm(initial=submission.submitter_parsed(), prefix="submitter")
|
submitter_form = NameEmailForm(initial=submission.submitter_parsed(), prefix="submitter")
|
||||||
replaces_form = ReplacesForm(initial=DocAlias.objects.filter(name__in=submission.replaces.split(",")))
|
replaces_form = ReplacesForm(name=submission.name,initial=DocAlias.objects.filter(name__in=submission.replaces.split(",")))
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
action = request.POST.get('action')
|
action = request.POST.get('action')
|
||||||
|
@ -208,7 +208,7 @@ def submission_status(request, submission_id, access_token=None):
|
||||||
return HttpResponseForbidden("You do not have permission to perfom this action")
|
return HttpResponseForbidden("You do not have permission to perfom this action")
|
||||||
|
|
||||||
submitter_form = NameEmailForm(request.POST, prefix="submitter")
|
submitter_form = NameEmailForm(request.POST, prefix="submitter")
|
||||||
replaces_form = ReplacesForm(request.POST)
|
replaces_form = ReplacesForm(request.POST, name=submission.name)
|
||||||
validations = [submitter_form.is_valid(), replaces_form.is_valid()]
|
validations = [submitter_form.is_valid(), replaces_form.is_valid()]
|
||||||
if all(validations):
|
if all(validations):
|
||||||
submission.submitter = submitter_form.cleaned_line()
|
submission.submitter = submitter_form.cleaned_line()
|
||||||
|
@ -345,7 +345,7 @@ def edit_submission(request, submission_id, access_token=None):
|
||||||
|
|
||||||
edit_form = EditSubmissionForm(request.POST, instance=submission, prefix="edit")
|
edit_form = EditSubmissionForm(request.POST, instance=submission, prefix="edit")
|
||||||
submitter_form = NameEmailForm(request.POST, prefix="submitter")
|
submitter_form = NameEmailForm(request.POST, prefix="submitter")
|
||||||
replaces_form = ReplacesForm(request.POST)
|
replaces_form = ReplacesForm(request.POST,name=submission.name)
|
||||||
author_forms = [ NameEmailForm(request.POST, email_required=False, prefix=prefix)
|
author_forms = [ NameEmailForm(request.POST, email_required=False, prefix=prefix)
|
||||||
for prefix in request.POST.getlist("authors-prefix")
|
for prefix in request.POST.getlist("authors-prefix")
|
||||||
if prefix != "authors-" ]
|
if prefix != "authors-" ]
|
||||||
|
@ -386,7 +386,7 @@ def edit_submission(request, submission_id, access_token=None):
|
||||||
else:
|
else:
|
||||||
edit_form = EditSubmissionForm(instance=submission, prefix="edit")
|
edit_form = EditSubmissionForm(instance=submission, prefix="edit")
|
||||||
submitter_form = NameEmailForm(initial=submission.submitter_parsed(), prefix="submitter")
|
submitter_form = NameEmailForm(initial=submission.submitter_parsed(), prefix="submitter")
|
||||||
replaces_form = ReplacesForm(initial=DocAlias.objects.filter(name__in=submission.replaces.split(",")))
|
replaces_form = ReplacesForm(name=submission.name,initial=DocAlias.objects.filter(name__in=submission.replaces.split(",")))
|
||||||
author_forms = [ NameEmailForm(initial=author, email_required=False, prefix="authors-%s" % i)
|
author_forms = [ NameEmailForm(initial=author, email_required=False, prefix="authors-%s" % i)
|
||||||
for i, author in enumerate(submission.authors_parsed()) ]
|
for i, author in enumerate(submission.authors_parsed()) ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue