# HG changeset patch # User RhodeCode Admin # Date 2024-01-15 13:33:34 # Node ID 9a7f2cde5af4cb0422be6d5d0c7c9e31c53b3fa9 # Parent a1331d35a1a7fe0d2239f9a71667002e4a23bb66 fix(validators): fixed improved error message on user group validators diff --git a/rhodecode/model/validators.py b/rhodecode/model/validators.py --- a/rhodecode/model/validators.py +++ b/rhodecode/model/validators.py @@ -164,8 +164,8 @@ def ValidUsername(localizer, edit=False, _('Username "%(username)s" is forbidden'), 'invalid_username': _('Username may only contain alphanumeric characters ' - 'underscores, periods or dashes and must begin with ' - 'alphanumeric character or underscore') + 'underscores, periods or dashes and must begin with ' + 'alphanumeric character or underscore') } def _validate_python(self, value, state): @@ -223,7 +223,7 @@ def ValidUserGroup(localizer, edit=False 'invalid_group': _('Invalid user group name'), 'group_exist': _('User group `%(usergroup)s` already exists'), 'invalid_usergroup_name': - _('user group name may only contain alphanumeric ' + _('User group name may only contain alphanumeric ' 'characters underscores, periods or dashes and must begin ' 'with alphanumeric character') } @@ -231,9 +231,7 @@ def ValidUserGroup(localizer, edit=False def _validate_python(self, value, state): if value in ['default']: msg = M(self, 'invalid_group', state) - raise formencode.Invalid( - msg, value, state, error_dict={'users_group_name': msg} - ) + raise formencode.Invalid(msg, value, state) # check if group is unique old_ugname = None if edit: @@ -251,9 +249,7 @@ def ValidUserGroup(localizer, edit=False if re.match(r'^[a-zA-Z0-9]{1}[a-zA-Z0-9\-\_\.]+$', value) is None: msg = M(self, 'invalid_usergroup_name', state) - raise formencode.Invalid( - msg, value, state, error_dict={'users_group_name': msg} - ) + raise formencode.Invalid(msg, value, state) return _validator