From 1a7f5e0cc4e66db243ce29f09d77479fc981099e Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Tue, 21 Dec 2010 12:14:38 -0500 Subject: 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 --- ipalib/parameters.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipalib/parameters.py') diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 955b9799..feccd7ea 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -748,8 +748,11 @@ class Param(ReadOnly): for rule in self.all_rules: error = rule(ugettext, value) if error is not None: + name = self.cli_name + if not name: + name = self.name raise ValidationError( - name=self.name, + name=name, value=value, index=index, error=error, -- cgit