##// END OF EJS Templates
fix(validators): fixed improved error message on user group validators
super-admin -
r5267:9a7f2cde default
parent child Browse files
Show More
@@ -223,7 +223,7 b' def ValidUserGroup(localizer, edit=False'
223 'invalid_group': _('Invalid user group name'),
223 'invalid_group': _('Invalid user group name'),
224 'group_exist': _('User group `%(usergroup)s` already exists'),
224 'group_exist': _('User group `%(usergroup)s` already exists'),
225 'invalid_usergroup_name':
225 'invalid_usergroup_name':
226 _('user group name may only contain alphanumeric '
226 _('User group name may only contain alphanumeric '
227 'characters underscores, periods or dashes and must begin '
227 'characters underscores, periods or dashes and must begin '
228 'with alphanumeric character')
228 'with alphanumeric character')
229 }
229 }
@@ -231,9 +231,7 b' def ValidUserGroup(localizer, edit=False'
231 def _validate_python(self, value, state):
231 def _validate_python(self, value, state):
232 if value in ['default']:
232 if value in ['default']:
233 msg = M(self, 'invalid_group', state)
233 msg = M(self, 'invalid_group', state)
234 raise formencode.Invalid(
234 raise formencode.Invalid(msg, value, state)
235 msg, value, state, error_dict={'users_group_name': msg}
236 )
237 # check if group is unique
235 # check if group is unique
238 old_ugname = None
236 old_ugname = None
239 if edit:
237 if edit:
@@ -251,9 +249,7 b' def ValidUserGroup(localizer, edit=False'
251
249
252 if re.match(r'^[a-zA-Z0-9]{1}[a-zA-Z0-9\-\_\.]+$', value) is None:
250 if re.match(r'^[a-zA-Z0-9]{1}[a-zA-Z0-9\-\_\.]+$', value) is None:
253 msg = M(self, 'invalid_usergroup_name', state)
251 msg = M(self, 'invalid_usergroup_name', state)
254 raise formencode.Invalid(
252 raise formencode.Invalid(msg, value, state)
255 msg, value, state, error_dict={'users_group_name': msg}
256 )
257 return _validator
253 return _validator
258
254
259
255
General Comments 0
You need to be logged in to leave comments. Login now