Convert the submit tool to associate RGs and IAB with drafts instead
of assigning them to individual submission, this is not a complete overhaul but at least basic support so submission works and doesn't say WG when it means RG. - Legacy-Id: 4910
This commit is contained in:
parent
49eb500692
commit
c20a5f6bf0
|
@ -12,6 +12,7 @@ from django.template.loader import render_to_string
|
|||
from django.utils.html import mark_safe
|
||||
from django.core.urlresolvers import reverse as urlreverse
|
||||
|
||||
from ietf.group.models import Group
|
||||
from ietf.idtracker.models import InternetDraft, IETFWG
|
||||
from ietf.proceedings.models import Meeting
|
||||
from ietf.submit.models import IdSubmissionDetail, TempIdAuthors, Preapproval
|
||||
|
@ -224,27 +225,36 @@ class UploadForm(forms.Form):
|
|||
self.idnits_message = p.stdout.read()
|
||||
|
||||
def get_working_group(self):
|
||||
filename = self.draft.filename
|
||||
existing_draft = InternetDraft.objects.filter(filename=filename)
|
||||
name = self.draft.filename
|
||||
existing_draft = InternetDraft.objects.filter(filename=name)
|
||||
if existing_draft:
|
||||
group = existing_draft[0].group and existing_draft[0].group.ietfwg or None
|
||||
if group and group.pk != NONE_WG:
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES and group.type_id == "area":
|
||||
return None
|
||||
if group and group.pk != NONE_WG and group.type_id != "area":
|
||||
return group
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
if filename.startswith('draft-ietf-'):
|
||||
# Extra check for WG that contains dashes
|
||||
for group in IETFWG.objects.filter(group_acronym__acronym__contains='-'):
|
||||
if filename.startswith('draft-ietf-%s-' % group.group_acronym.acronym):
|
||||
return group
|
||||
group_acronym = filename.split('-')[2]
|
||||
if name.startswith('draft-ietf-') or name.startswith("draft-irtf-"):
|
||||
components = name.split("-")
|
||||
if len(components) < 3:
|
||||
raise forms.ValidationError("The draft name \"%s\" is missing a third part, please rename it")
|
||||
|
||||
if components[1] == "ietf":
|
||||
group_type = "wg"
|
||||
else:
|
||||
group_type = "rg"
|
||||
|
||||
# first check groups with dashes
|
||||
for g in Group.objects.filter(acronym__contains="-", type=group_type):
|
||||
if name.startswith('draft-%s-%s-' % (components[1], g.acronym)):
|
||||
return IETFWG().from_object(g)
|
||||
|
||||
try:
|
||||
return IETFWG.objects.get(group_acronym__acronym=group_acronym)
|
||||
except IETFWG.DoesNotExist:
|
||||
raise forms.ValidationError('There is no active group with acronym \'%s\', please rename your draft' % group_acronym)
|
||||
return IETFWG().from_object(Group.objects.get(acronym=components[2], type=group_type))
|
||||
except Group.DoesNotExist:
|
||||
raise forms.ValidationError('There is no active group with acronym \'%s\', please rename your draft' % components[2])
|
||||
elif name.startswith("draft-iab-"):
|
||||
return IETFWG().from_object(Group.objects.get(acronym="iab"))
|
||||
else:
|
||||
return None
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@ class SubmitTestCase(django.test.TestCase):
|
|||
self.assertTrue(os.path.exists(os.path.join(self.staging_dir, u"%s-%s.txt" % (name, rev))))
|
||||
self.assertEquals(IdSubmissionDetail.objects.filter(filename=name).count(), 1)
|
||||
submission = IdSubmissionDetail.objects.get(filename=name)
|
||||
self.assertEquals(submission.group_acronym.acronym, "mars")
|
||||
self.assertEquals(submission.tempidauthors_set.count(), 1)
|
||||
self.assertTrue(re.search('\s+Summary:\s+0\s+errors|No nits found', submission.idnits_message))
|
||||
author = submission.tempidauthors_set.all()[0]
|
||||
|
@ -139,6 +138,7 @@ class SubmitTestCase(django.test.TestCase):
|
|||
draft = Document.objects.get(docalias__name=name)
|
||||
self.assertEquals(draft.rev, rev)
|
||||
new_revision = draft.latest_event()
|
||||
self.assertEquals(draft.group.acronym, "mars")
|
||||
self.assertEquals(new_revision.type, "new_revision")
|
||||
self.assertEquals(new_revision.by.name, "Test Name")
|
||||
self.assertTrue(not os.path.exists(os.path.join(self.staging_dir, u"%s-%s.txt" % (name, rev))))
|
||||
|
@ -224,6 +224,7 @@ class SubmitTestCase(django.test.TestCase):
|
|||
|
||||
draft = Document.objects.get(docalias__name=name)
|
||||
self.assertEquals(draft.rev, rev)
|
||||
self.assertEquals(draft.group.acronym, name.split("-")[2])
|
||||
self.assertEquals(draft.docevent_set.all()[1].type, "new_revision")
|
||||
self.assertEquals(draft.docevent_set.all()[1].by.name, "Test Name")
|
||||
self.assertTrue(not os.path.exists(os.path.join(self.repository_dir, "%s-%s.txt" % (name, old_rev))))
|
||||
|
@ -250,6 +251,38 @@ class SubmitTestCase(django.test.TestCase):
|
|||
self.assertTrue(name in unicode(outbox[-1]))
|
||||
self.assertTrue("mars" in unicode(outbox[-1]))
|
||||
|
||||
def test_submit_new_wg_with_dash(self):
|
||||
draft = make_test_data()
|
||||
|
||||
group = Group.objects.create(acronym="mars-special", name="Mars Special", type_id="wg", state_id="active")
|
||||
|
||||
name = "draft-ietf-%s-testing-tests" % group.acronym
|
||||
|
||||
self.do_submission(name, "00")
|
||||
|
||||
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.acronym, group.acronym)
|
||||
|
||||
def test_submit_new_irtf(self):
|
||||
draft = make_test_data()
|
||||
|
||||
group = Group.objects.create(acronym="saturnrg", name="Saturn", type_id="rg", state_id="active")
|
||||
|
||||
name = "draft-irtf-%s-testing-tests" % group.acronym
|
||||
|
||||
self.do_submission(name, "00")
|
||||
|
||||
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.acronym, group.acronym)
|
||||
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.type_id, group.type_id)
|
||||
|
||||
def test_submit_new_iab(self):
|
||||
draft = make_test_data()
|
||||
|
||||
name = "draft-iab-testing-tests"
|
||||
|
||||
self.do_submission(name, "00")
|
||||
|
||||
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.acronym, "iab")
|
||||
|
||||
def test_cancel_submission(self):
|
||||
# submit -> cancel
|
||||
draft = make_test_data()
|
||||
|
|
|
@ -579,7 +579,7 @@ class DraftValidation(object):
|
|||
|
||||
def validate_wg(self):
|
||||
if self.wg and not self.wg.status_id == IETFWG.ACTIVE:
|
||||
self.add_warning('group', 'Working Group exists but is not an active WG')
|
||||
self.add_warning('group', 'Group exists but is not an active group')
|
||||
|
||||
def validate_abstract(self):
|
||||
if not self.draft.abstract:
|
||||
|
|
|
@ -114,7 +114,7 @@ def draft_status(request, submission_id, submission_hash=None, message=None):
|
|||
except Preapproval.DoesNotExist:
|
||||
preapproval = None
|
||||
|
||||
if detail.revision == '00' and detail.group_acronym and not preapproval:
|
||||
if detail.revision == '00' and detail.group_acronym and detail.group_acronym.type_id == "wg" and not preapproval:
|
||||
detail.status_id = INITIAL_VERSION_APPROVAL_REQUESTED
|
||||
detail.save()
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Filename: {{ submission.filename }}
|
|||
Revision: {{ submission.revision }}
|
||||
Title: {{ submission.id_document_name }}
|
||||
Creation date: {{ submission.creation_date|date:"Y-m-d" }}
|
||||
WG ID: {{ wg }}
|
||||
Group: {{ wg }}
|
||||
Number of pages: {{ submission.txt_page_count }}
|
||||
URL: http://www.ietf.org/internet-drafts/{{ submission.filename }}-{{ submission.revision }}.txt
|
||||
Status: http://datatracker.ietf.org/doc/{{ submission.filename }}
|
||||
|
|
|
@ -93,7 +93,7 @@ table.ietf-table span.field-error { display: block; color: red; }
|
|||
{% show_submission_files detail %}
|
||||
</td></tr>
|
||||
<tr><th>Submission date</th><td>{{ detail.submission_date }}</td></tr>
|
||||
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>WG</th><td>{{ validation.wg|default:"Individual Submission" }}
|
||||
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>Group</th><td>{{ validation.wg|default:"Individual Submission" }}
|
||||
{% if validation.warnings.group %}
|
||||
<div class="warn_message">The secretariat will be notified that the working group is not active</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -149,7 +149,7 @@ returned to the submitter.
|
|||
</td>
|
||||
</tr>
|
||||
<tr{% if validation.warnings.revision %} class="warning"{% endif %}><th>Revision</th><td>{{ detail.revision }}<div class="warn_message">{{ validation.warnings.revision }}{% if validation.warnings.revision %}<br /><a class="twopages_trigger" href="#">[View error]</a>{% endif %}</div></td></tr>
|
||||
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>WG</th><td>{{ validation.wg|default:"Individual Submission" }}<div class="warn_message">{{ validation.warnings.group }}</div></td></tr>
|
||||
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>Group</th><td>{{ validation.wg|default:"Individual Submission" }}<div class="warn_message">{{ validation.warnings.group }}</div></td></tr>
|
||||
<tr{% if validation.warnings.creation_date %} class="warning"{% endif %}><th>Document date</th><td>{{ detail.creation_date }}<div class="warn_message">{{ validation.warnings.creation_date }}</div></td></tr>
|
||||
<tr><th>Submission date</th><td>{{ detail.submission_date }}</td></tr>
|
||||
<tr{% if validation.warnings.title %} class="warning"{% endif %}><th>Title</th><td>{{ detail.id_document_name|default:"" }}<div class="warn_message">{{ validation.warnings.title }}</div></td></tr>
|
||||
|
|
|
@ -9,7 +9,7 @@ I-D Submission Tool URL:
|
|||
File name : {{ draft.filename }}
|
||||
Version : {{ draft.revision }}
|
||||
Submission date : {{ draft.submission_date }}
|
||||
WG : {{ draft.group_acronym|default:"Individual Submission" }} {% if form.validation.warnings.group %}*Please note that this WG is not an active one*{% endif %}
|
||||
Group : {{ draft.group_acronym|default:"Individual Submission" }} {% if form.validation.warnings.group %}*Please note that this group is not an active one*{% endif %}
|
||||
|
||||
Title : {{ draft.id_document_name }}
|
||||
Document date : {{ draft.creation_date }}
|
||||
|
|
|
@ -9,7 +9,7 @@ To approve the draft, go to this URL (note: you need to login to be able to appr
|
|||
File name : {{ draft.filename }}
|
||||
Version : {{ draft.revision }}
|
||||
Submission date : {{ draft.submission_date }}
|
||||
WG : {{ draft.group_acronym|default:"Individual Submission" }}
|
||||
Group : {{ draft.group_acronym|default:"Individual Submission" }}
|
||||
|
||||
Title : {{ draft.id_document_name }}
|
||||
Document date : {{ draft.creation_date }}
|
||||
|
|
Loading…
Reference in a new issue