From c20a5f6bf05d0b4067956fb442a928134b9f2e88 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Wed, 10 Oct 2012 16:15:09 +0000 Subject: [PATCH] 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 --- ietf/submit/forms.py | 38 ++++++++++++------- ietf/submit/tests.py | 35 ++++++++++++++++- ietf/submit/utils.py | 2 +- ietf/submit/views.py | 2 +- ietf/templates/submit/announce_to_authors.txt | 2 +- ietf/templates/submit/draft_edit.html | 2 +- ietf/templates/submit/draft_status.html | 2 +- ietf/templates/submit/manual_post_mail.txt | 2 +- ietf/templates/submit/submission_approval.txt | 2 +- 9 files changed, 65 insertions(+), 22 deletions(-) diff --git a/ietf/submit/forms.py b/ietf/submit/forms.py index e12c0aef5..4fb53e166 100644 --- a/ietf/submit/forms.py +++ b/ietf/submit/forms.py @@ -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 diff --git a/ietf/submit/tests.py b/ietf/submit/tests.py index 09b1116b5..071146f68 100644 --- a/ietf/submit/tests.py +++ b/ietf/submit/tests.py @@ -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() diff --git a/ietf/submit/utils.py b/ietf/submit/utils.py index 09eb0a34a..a247ffba8 100644 --- a/ietf/submit/utils.py +++ b/ietf/submit/utils.py @@ -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: diff --git a/ietf/submit/views.py b/ietf/submit/views.py index c5659e2c9..8b3e8410b 100644 --- a/ietf/submit/views.py +++ b/ietf/submit/views.py @@ -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() diff --git a/ietf/templates/submit/announce_to_authors.txt b/ietf/templates/submit/announce_to_authors.txt index e405724dd..c3e875f14 100644 --- a/ietf/templates/submit/announce_to_authors.txt +++ b/ietf/templates/submit/announce_to_authors.txt @@ -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 }} diff --git a/ietf/templates/submit/draft_edit.html b/ietf/templates/submit/draft_edit.html index 3426ec3f2..a1d865374 100644 --- a/ietf/templates/submit/draft_edit.html +++ b/ietf/templates/submit/draft_edit.html @@ -93,7 +93,7 @@ table.ietf-table span.field-error { display: block; color: red; } {% show_submission_files detail %} Submission date{{ detail.submission_date }} -WG{{ validation.wg|default:"Individual Submission" }} +Group{{ validation.wg|default:"Individual Submission" }} {% if validation.warnings.group %}
The secretariat will be notified that the working group is not active
{% endif %} diff --git a/ietf/templates/submit/draft_status.html b/ietf/templates/submit/draft_status.html index 30bd84ee3..09c7c9aa0 100644 --- a/ietf/templates/submit/draft_status.html +++ b/ietf/templates/submit/draft_status.html @@ -149,7 +149,7 @@ returned to the submitter. Revision{{ detail.revision }}
{{ validation.warnings.revision }}{% if validation.warnings.revision %}
[View error]{% endif %}
-WG{{ validation.wg|default:"Individual Submission" }}
{{ validation.warnings.group }}
+Group{{ validation.wg|default:"Individual Submission" }}
{{ validation.warnings.group }}
Document date{{ detail.creation_date }}
{{ validation.warnings.creation_date }}
Submission date{{ detail.submission_date }} Title{{ detail.id_document_name|default:"" }}
{{ validation.warnings.title }}
diff --git a/ietf/templates/submit/manual_post_mail.txt b/ietf/templates/submit/manual_post_mail.txt index 5c06f9cc0..7fd5ffd9c 100644 --- a/ietf/templates/submit/manual_post_mail.txt +++ b/ietf/templates/submit/manual_post_mail.txt @@ -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 }} diff --git a/ietf/templates/submit/submission_approval.txt b/ietf/templates/submit/submission_approval.txt index 51ea3e6b7..ddfa7fd94 100644 --- a/ietf/templates/submit/submission_approval.txt +++ b/ietf/templates/submit/submission_approval.txt @@ -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 }}