Skip to content

Commit c20a5f6

Browse files
committed
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
1 parent 49eb500 commit c20a5f6

9 files changed

Lines changed: 65 additions & 22 deletions

File tree

ietf/submit/forms.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from django.utils.html import mark_safe
1313
from django.core.urlresolvers import reverse as urlreverse
1414

15+
from ietf.group.models import Group
1516
from ietf.idtracker.models import InternetDraft, IETFWG
1617
from ietf.proceedings.models import Meeting
1718
from ietf.submit.models import IdSubmissionDetail, TempIdAuthors, Preapproval
@@ -224,27 +225,36 @@ def check_idnits(self):
224225
self.idnits_message = p.stdout.read()
225226

226227
def get_working_group(self):
227-
filename = self.draft.filename
228-
existing_draft = InternetDraft.objects.filter(filename=filename)
228+
name = self.draft.filename
229+
existing_draft = InternetDraft.objects.filter(filename=name)
229230
if existing_draft:
230231
group = existing_draft[0].group and existing_draft[0].group.ietfwg or None
231-
if group and group.pk != NONE_WG:
232-
if settings.USE_DB_REDESIGN_PROXY_CLASSES and group.type_id == "area":
233-
return None
232+
if group and group.pk != NONE_WG and group.type_id != "area":
234233
return group
235234
else:
236235
return None
237236
else:
238-
if filename.startswith('draft-ietf-'):
239-
# Extra check for WG that contains dashes
240-
for group in IETFWG.objects.filter(group_acronym__acronym__contains='-'):
241-
if filename.startswith('draft-ietf-%s-' % group.group_acronym.acronym):
242-
return group
243-
group_acronym = filename.split('-')[2]
237+
if name.startswith('draft-ietf-') or name.startswith("draft-irtf-"):
238+
components = name.split("-")
239+
if len(components) < 3:
240+
raise forms.ValidationError("The draft name \"%s\" is missing a third part, please rename it")
241+
242+
if components[1] == "ietf":
243+
group_type = "wg"
244+
else:
245+
group_type = "rg"
246+
247+
# first check groups with dashes
248+
for g in Group.objects.filter(acronym__contains="-", type=group_type):
249+
if name.startswith('draft-%s-%s-' % (components[1], g.acronym)):
250+
return IETFWG().from_object(g)
251+
244252
try:
245-
return IETFWG.objects.get(group_acronym__acronym=group_acronym)
246-
except IETFWG.DoesNotExist:
247-
raise forms.ValidationError('There is no active group with acronym \'%s\', please rename your draft' % group_acronym)
253+
return IETFWG().from_object(Group.objects.get(acronym=components[2], type=group_type))
254+
except Group.DoesNotExist:
255+
raise forms.ValidationError('There is no active group with acronym \'%s\', please rename your draft' % components[2])
256+
elif name.startswith("draft-iab-"):
257+
return IETFWG().from_object(Group.objects.get(acronym="iab"))
248258
else:
249259
return None
250260

ietf/submit/tests.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def do_submission(self, name, rev):
7575
self.assertTrue(os.path.exists(os.path.join(self.staging_dir, u"%s-%s.txt" % (name, rev))))
7676
self.assertEquals(IdSubmissionDetail.objects.filter(filename=name).count(), 1)
7777
submission = IdSubmissionDetail.objects.get(filename=name)
78-
self.assertEquals(submission.group_acronym.acronym, "mars")
7978
self.assertEquals(submission.tempidauthors_set.count(), 1)
8079
self.assertTrue(re.search('\s+Summary:\s+0\s+errors|No nits found', submission.idnits_message))
8180
author = submission.tempidauthors_set.all()[0]
@@ -139,6 +138,7 @@ def test_submit_new(self):
139138
draft = Document.objects.get(docalias__name=name)
140139
self.assertEquals(draft.rev, rev)
141140
new_revision = draft.latest_event()
141+
self.assertEquals(draft.group.acronym, "mars")
142142
self.assertEquals(new_revision.type, "new_revision")
143143
self.assertEquals(new_revision.by.name, "Test Name")
144144
self.assertTrue(not os.path.exists(os.path.join(self.staging_dir, u"%s-%s.txt" % (name, rev))))
@@ -224,6 +224,7 @@ def test_submit_existing(self):
224224

225225
draft = Document.objects.get(docalias__name=name)
226226
self.assertEquals(draft.rev, rev)
227+
self.assertEquals(draft.group.acronym, name.split("-")[2])
227228
self.assertEquals(draft.docevent_set.all()[1].type, "new_revision")
228229
self.assertEquals(draft.docevent_set.all()[1].by.name, "Test Name")
229230
self.assertTrue(not os.path.exists(os.path.join(self.repository_dir, "%s-%s.txt" % (name, old_rev))))
@@ -250,6 +251,38 @@ def test_submit_existing(self):
250251
self.assertTrue(name in unicode(outbox[-1]))
251252
self.assertTrue("mars" in unicode(outbox[-1]))
252253

254+
def test_submit_new_wg_with_dash(self):
255+
draft = make_test_data()
256+
257+
group = Group.objects.create(acronym="mars-special", name="Mars Special", type_id="wg", state_id="active")
258+
259+
name = "draft-ietf-%s-testing-tests" % group.acronym
260+
261+
self.do_submission(name, "00")
262+
263+
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.acronym, group.acronym)
264+
265+
def test_submit_new_irtf(self):
266+
draft = make_test_data()
267+
268+
group = Group.objects.create(acronym="saturnrg", name="Saturn", type_id="rg", state_id="active")
269+
270+
name = "draft-irtf-%s-testing-tests" % group.acronym
271+
272+
self.do_submission(name, "00")
273+
274+
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.acronym, group.acronym)
275+
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.type_id, group.type_id)
276+
277+
def test_submit_new_iab(self):
278+
draft = make_test_data()
279+
280+
name = "draft-iab-testing-tests"
281+
282+
self.do_submission(name, "00")
283+
284+
self.assertEquals(IdSubmissionDetail.objects.get(filename=name).group_acronym.acronym, "iab")
285+
253286
def test_cancel_submission(self):
254287
# submit -> cancel
255288
draft = make_test_data()

ietf/submit/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def validate_title(self):
579579

580580
def validate_wg(self):
581581
if self.wg and not self.wg.status_id == IETFWG.ACTIVE:
582-
self.add_warning('group', 'Working Group exists but is not an active WG')
582+
self.add_warning('group', 'Group exists but is not an active group')
583583

584584
def validate_abstract(self):
585585
if not self.draft.abstract:

ietf/submit/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def draft_status(request, submission_id, submission_hash=None, message=None):
114114
except Preapproval.DoesNotExist:
115115
preapproval = None
116116

117-
if detail.revision == '00' and detail.group_acronym and not preapproval:
117+
if detail.revision == '00' and detail.group_acronym and detail.group_acronym.type_id == "wg" and not preapproval:
118118
detail.status_id = INITIAL_VERSION_APPROVAL_REQUESTED
119119
detail.save()
120120

ietf/templates/submit/announce_to_authors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Filename: {{ submission.filename }}
77
Revision: {{ submission.revision }}
88
Title: {{ submission.id_document_name }}
99
Creation date: {{ submission.creation_date|date:"Y-m-d" }}
10-
WG ID: {{ wg }}
10+
Group: {{ wg }}
1111
Number of pages: {{ submission.txt_page_count }}
1212
URL: http://www.ietf.org/internet-drafts/{{ submission.filename }}-{{ submission.revision }}.txt
1313
Status: http://datatracker.ietf.org/doc/{{ submission.filename }}

ietf/templates/submit/draft_edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ <h2>Adjust External Meta-Data</h2>
9393
{% show_submission_files detail %}
9494
</td></tr>
9595
<tr><th>Submission date</th><td>{{ detail.submission_date }}</td></tr>
96-
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>WG</th><td>{{ validation.wg|default:"Individual Submission" }}
96+
<tr{% if validation.warnings.group %} class="warning"{% endif %}><th>Group</th><td>{{ validation.wg|default:"Individual Submission" }}
9797
{% if validation.warnings.group %}
9898
<div class="warn_message">The secretariat will be notified that the working group is not active</div>
9999
{% endif %}

ietf/templates/submit/draft_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ <h3>Meta-Data errors found</h3>
149149
</td>
150150
</tr>
151151
<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>
152-
<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>
152+
<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>
153153
<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>
154154
<tr><th>Submission date</th><td>{{ detail.submission_date }}</td></tr>
155155
<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>

ietf/templates/submit/manual_post_mail.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ I-D Submission Tool URL:
99
File name : {{ draft.filename }}
1010
Version : {{ draft.revision }}
1111
Submission date : {{ draft.submission_date }}
12-
WG : {{ draft.group_acronym|default:"Individual Submission" }} {% if form.validation.warnings.group %}*Please note that this WG is not an active one*{% endif %}
12+
Group : {{ draft.group_acronym|default:"Individual Submission" }} {% if form.validation.warnings.group %}*Please note that this group is not an active one*{% endif %}
1313

1414
Title : {{ draft.id_document_name }}
1515
Document date : {{ draft.creation_date }}

ietf/templates/submit/submission_approval.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To approve the draft, go to this URL (note: you need to login to be able to appr
99
File name : {{ draft.filename }}
1010
Version : {{ draft.revision }}
1111
Submission date : {{ draft.submission_date }}
12-
WG : {{ draft.group_acronym|default:"Individual Submission" }}
12+
Group : {{ draft.group_acronym|default:"Individual Submission" }}
1313

1414
Title : {{ draft.id_document_name }}
1515
Document date : {{ draft.creation_date }}

0 commit comments

Comments
 (0)