From 6437db69cd1496c1d9350d9030e3e2d6bb4e05aa Mon Sep 17 00:00:00 2001 From: RhodeCode Admin Date: Mon, 15 Jan 2024 14:33:34 +0100 Subject: [PATCH] fix(validators): fixed improved error message on user group validators --- rhodecode/model/validators.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/rhodecode/model/validators.py b/rhodecode/model/validators.py index 89c43669..67ff9d0b 100644 --- a/rhodecode/model/validators.py +++ b/rhodecode/model/validators.py @@ -164,8 +164,8 @@ def ValidUsername(localizer, edit=False, old_data=None): _('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, old_data=None): '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, old_data=None): 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, old_data=None): 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