Repository: ietf-tools/datatracker

Issue:
group admin form should allow acronyms that start with numbers other sdo groups.
We already have things like `'3gpp-tsgct', '3gpp-tsgct-ct1', '3gpp-tsgct-ct3', '3gpp-tsgct-ct4'`. If we want more 3gpp-tsgct, the admin shouldn't block us.


Discussion:
But any IETF, IRTF, IAB, etc related groups should follow the current restrictions

Resolving patch:
diff --git a/ietf/group/admin.py b/ietf/group/admin.py
--- a/ietf/group/admin.py
+++ b/ietf/group/admin.py
@@ -1,4 +1,4 @@
-# Copyright The IETF Trust 2010-2020, All Rights Reserved
+# Copyright The IETF Trust 2010-2024, All Rights Reserved
 # -*- coding: utf-8 -*-
 
 import re
@@ -72,6 +72,12 @@ def clean(self):
                     'Acronym is invalid. For groups that create documents, the acronym must be at least '
                     'two characters and only contain lowercase letters and numbers starting with a letter.'
                 )
+            elif self.cleaned_data['type'].pk == 'sdo':
+                valid_re = r'^[a-z0-9][a-z0-9-]*[a-z0-9]$'
+                error_msg = (
+                    'Acronym is invalid. It must be at least two characters and only contain lowercase '
+                    'letters and numbers. It may contain hyphens, but that is discouraged.'
+                )
             else:
                 valid_re = r'^[a-z][a-z0-9-]*[a-z0-9]$'
                 error_msg = (


Test patch:
diff --git a/ietf/group/tests_info.py b/ietf/group/tests_info.py
--- a/ietf/group/tests_info.py
+++ b/ietf/group/tests_info.py
@@ -1,4 +1,4 @@
-# Copyright The IETF Trust 2009-2023, All Rights Reserved
+# Copyright The IETF Trust 2009-2024, All Rights Reserved
 # -*- coding: utf-8 -*-
 
 
@@ -2044,8 +2044,17 @@ def test_admin_acronym_validation(self):
         self.assertTrue(form.is_valid())
         form = AdminGroupForm({'acronym':'shouldfail-','name':'should fail','type':'wg','state':'active','used_roles':'[]','time':now})
         self.assertIn('acronym',form.errors)
+        form = AdminGroupForm({'acronym':'shouldfail-','name':'should fail','type':'sdo','state':'active','used_roles':'[]','time':now})
+        self.assertIn('acronym',form.errors)
         form = AdminGroupForm({'acronym':'-shouldfail','name':'should fail','type':'wg','state':'active','used_roles':'[]','time':now})
         self.assertIn('acronym',form.errors)
+        form = AdminGroupForm({'acronym':'-shouldfail','name':'should fail','type':'sdo','state':'active','used_roles':'[]','time':now})
+        self.assertIn('acronym',form.errors)
+        # SDO groups (and only SDO groups) can have a leading number
+        form = AdminGroupForm({'acronym':'3gpp-should-pass','name':'should pass','type':'sdo','state':'active','used_roles':'[]','time':now})
+        self.assertTrue(form.is_valid())
+        form = AdminGroupForm({'acronym':'123shouldfail','name':'should fail','type':'wg','state':'active','used_roles':'[]','time':now})
+        self.assertIn('acronym',form.errors)
 
         wg = GroupFactory(acronym='bad-idea', type_id='wg') # There are some existing wg and programs with hyphens in their acronyms.
         form = AdminGroupForm({'acronym':wg.acronym,'name':wg.name,'type':wg.type_id,'state':wg.state_id,'used_roles':str(wg.used_roles),'time':now},instance=wg)