Allow 1-3 digit RFCs in status change documents.

Fixes bug 
Commit ready for merge
 - Legacy-Id: 7292
This commit is contained in:
Robert Sparks 2014-02-24 15:43:32 +00:00
parent c09bcebdb3
commit 31808eccb2
5 changed files with 27 additions and 25 deletions

View file

@ -364,18 +364,20 @@ class StatusChangeTests(TestCase):
statchg_relation_row_blah="toexp",
new_relation_row_foo="rfc9998",
statchg_relation_row_foo="tobcp",
new_relation_row_nob="rfc14",
statchg_relation_row_nob="tohist",
Submit="Submit"))
self.assertEqual(r.status_code, 302)
doc = Document.objects.get(name='status-change-imaginary-mid-review')
self.assertEqual(doc.relateddocument_set.count(),2)
verify9999 = doc.relateddocument_set.filter(target__name='rfc9999')
self.assertTrue(verify9999)
self.assertEqual(verify9999.count(),1)
self.assertEqual(verify9999[0].relationship.slug,'toexp')
verify9998 = doc.relateddocument_set.filter(target__name='rfc9998')
self.assertTrue(verify9998)
self.assertEqual(verify9998.count(),1)
self.assertEqual(verify9998[0].relationship.slug,'tobcp')
self.assertEqual(doc.relateddocument_set.count(),3)
def verify_relations(doc,target_name,status):
target_doc=doc.relateddocument_set.filter(target__name=target_name)
self.assertTrue(target_doc)
self.assertEqual(target_doc.count(),1)
self.assertEqual(target_doc[0].relationship.slug,status)
verify_relations(doc,'rfc9999','toexp' )
verify_relations(doc,'rfc9998','tobcp' )
verify_relations(doc,'rfc14' ,'tohist')
self.assertTrue(doc.latest_event(DocEvent,type="added_comment").desc.startswith('Affected RFC list changed.'))
def setUp(self):

View file

@ -430,7 +430,7 @@ def clean_helper(form, formtype):
for k in sorted(form.data.iterkeys()):
v = form.data[k]
if k.startswith('new_relation_row'):
if re.match('\d{4}',v):
if re.match('\d{1,4}',v):
v = 'rfc'+v
rfc_fields[k[17:]]=v
elif k.startswith('statchg_relation_row'):
@ -444,8 +444,8 @@ def clean_helper(form, formtype):
errors=[]
for key in new_relations:
if not re.match('(?i)rfc\d{4}',key):
errors.append(key+" is not a valid RFC - please use the form RFCxxxx\n")
if not re.match('(?i)rfc\d{1,4}',key):
errors.append(key+" is not a valid RFC - please use the form RFCn\n")
elif not DocAlias.objects.filter(name=key):
errors.append(key+" does not exist\n")
@ -536,7 +536,7 @@ def start_rfc_status_change(request,name):
"""Start the RFC status change review process, setting the initial shepherding AD, and possibly putting the review on a telechat."""
if name:
if not re.match("(?i)rfc[0-9]{4}",name):
if not re.match("(?i)rfc[0-9]{1,4}",name):
raise Http404
seed_rfc = get_object_or_404(Document, type="draft", docalias__name=name)

View file

@ -59,7 +59,7 @@ form.start-rfc-status-change-review .actions {
</td>
</tr>
</tbody></table>
<div class="help">Enter one of the affected RFC as RFCXXXX</div>
<div class="help">Enter one of the affected RFC as RFCn</div>
{{ form.non_field_errors }}
</td>
</tr>

View file

@ -64,7 +64,7 @@ form.start-rfc-status-change-review .actions {
</td>
</tr>
</tbody></table>
<div class="help">Enter one of the affected RFC as RFCXXXX</div>
<div class="help">Enter one of the affected RFC as RFCn</div>
{{ form.non_field_errors }}
</td>
</tr>

View file

@ -289,15 +289,15 @@ def make_test_data():
docalias = DocAlias.objects.create(name='status-change-imaginary-mid-review',document=doc)
# Some things for a status change to affect
target_rfc = Document.objects.create(name='draft-ietf-random-thing', type_id='draft', std_level_id='ps')
target_rfc.set_state(State.objects.get(slug='rfc',type__slug='draft'))
target_rfc.save()
docalias = DocAlias.objects.create(name='draft-ietf-random-thing',document=target_rfc)
docalias = DocAlias.objects.create(name='rfc9999',document=target_rfc)
target_rfc = Document.objects.create(name='draft-ietf-random-otherthing', type_id='draft', std_level_id='inf')
target_rfc.set_state(State.objects.get(slug='rfc',type__slug='draft'))
target_rfc.save()
docalias = DocAlias.objects.create(name='draft-ietf-random-otherthing',document=target_rfc)
docalias = DocAlias.objects.create(name='rfc9998',document=target_rfc)
def rfc_for_status_change_test_factory(name,rfc_num,std_level_id):
target_rfc = Document.objects.create(name=name, type_id='draft', std_level_id=std_level_id)
target_rfc.set_state(State.objects.get(slug='rfc',type__slug='draft'))
target_rfc.save()
docalias = DocAlias.objects.create(name=name,document=target_rfc)
docalias = DocAlias.objects.create(name='rfc%d'%rfc_num,document=target_rfc)
return target_rfc
rfc_for_status_change_test_factory('draft-ietf-random-thing',9999,'ps')
rfc_for_status_change_test_factory('draft-ietf-random-otherthing',9998,'inf')
rfc_for_status_change_test_factory('draft-was-never-issued',14,'unkn')
return draft