diff options
author | Pavel Zuna <pzuna@redhat.com> | 2010-12-21 12:14:38 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-12-21 12:57:41 -0500 |
commit | 1a7f5e0cc4e66db243ce29f09d77479fc981099e (patch) | |
tree | cec239493b488b3d11df7ff058151077da0b6f0f /ipalib/plugins/user.py | |
parent | 7bcc533d95f6c8309e789e6a1940f3f65e0a75af (diff) | |
download | freeipa-1a7f5e0cc4e66db243ce29f09d77479fc981099e.tar.gz freeipa-1a7f5e0cc4e66db243ce29f09d77479fc981099e.tar.xz freeipa-1a7f5e0cc4e66db243ce29f09d77479fc981099e.zip |
Fix reporting of errors when validating parameters.
Print the attribute CLI name instead of its 'real' name.
The real name is usually the name of the corresponding LDAP
attribute, which is confusing to the user.
This way we get:
Invalid 'login': blablabla
instead of:
Invalid 'uid': blablabla
Another example:
Invalid 'hostname': blablabla
instead of:
Invalid 'fqdn': blablabla
Ticket #435
Diffstat (limited to 'ipalib/plugins/user.py')
-rw-r--r-- | ipalib/plugins/user.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py index f76fbd63..62097549 100644 --- a/ipalib/plugins/user.py +++ b/ipalib/plugins/user.py @@ -227,7 +227,13 @@ class user_add(LDAPCreate): config = ldap.get_ipa_config()[1] if 'ipamaxusernamelength' in config: if len(keys[-1]) > int(config.get('ipamaxusernamelength')[0]): - raise errors.ValidationError(name='uid', error=_('can be at most %(len)d characters' % dict(len = int(config.get('ipamaxusernamelength')[0])))) + raise errors.ValidationError( + name=self.obj.primary_key.cli_name, error=_( + 'can be at most %(len)d characters' % dict( + len = int(config.get('ipamaxusernamelength')[0]) + ) + ) + ) entry_attrs.setdefault('loginshell', config.get('ipadefaultloginshell')) # hack so we can request separate first and last name in CLI full_name = '%s %s' % (entry_attrs['givenname'], entry_attrs['sn']) |