Skip to content

Commit 79c3182

Browse files
committed
Merged in [17491] from rcross@amsl.com:
Prevent use of capital letters in group acronym. Fixes ietf-tools#2709. - Legacy-Id: 17513 Note: SVN reference [17491] has been migrated to Git commit 3969d6c
2 parents 02dd05a + 3969d6c commit 79c3182

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

ietf/secr/groups/forms.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ def __init__(self, *args, **kwargs):
7474
if lsgc:
7575
self.fields['liaison_contacts'].initial = lsgc.contacts
7676

77+
def clean_acronym(self):
78+
acronym = self.cleaned_data['acronym']
79+
if any(x.isupper() for x in acronym):
80+
raise forms.ValidationError('Capital letters not allowed in group acronym')
81+
return acronym
82+
7783
def clean_parent(self):
7884
parent = self.cleaned_data['parent']
7985
type = self.cleaned_data['type']

ietf/secr/groups/tests.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ def test_add_group_success(self):
8484
response = self.client.post(url,post_data)
8585
self.assertEqual(response.status_code, 200)
8686

87+
def test_add_group_capital_acronym(self):
88+
area = GroupFactory(type_id='area')
89+
url = reverse('ietf.secr.groups.views.add')
90+
post_data = {'acronym':'TEST',
91+
'name':'Test Group',
92+
'type':'wg',
93+
'status':'active',
94+
'parent':area.id,
95+
'awp-TOTAL_FORMS':'2',
96+
'awp-INITIAL_FORMS':'0',
97+
'submit':'Save'}
98+
self.client.login(username="secretary", password="secretary+password")
99+
response = self.client.post(url,post_data)
100+
self.assertEqual(response.status_code, 200)
101+
self.assertContains(response, 'Capital letters not allowed in group acronym')
102+
87103
# ------- Test View -------- #
88104
def test_view(self):
89105
MeetingFactory(type_id='ietf')

0 commit comments

Comments
 (0)