From 7cfc16ca58dfb22bc6e9cd519e6ecc7a10435fa1 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 16 Feb 2012 07:11:56 -0500 Subject: Enforce that required attributes can't be set to None in CRUD Update The `required` parameter attribute didn't distinguish between cases where the parameter is not given and all, and where the parameter is given but empty. The case of updating a required attribute couldn't be validated properly, because when it is given but empty, validators don't run. This patch introduces a new flag, 'nonempty', that specifies the parameter can be missing (if not required), but it can't be None. This flag gets added automatically to required parameters in CRUD Update. --- ipalib/frontend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipalib/frontend.py') diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 028e17e7..da25b4c1 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -651,7 +651,7 @@ class Command(HasParam): """ for param in self.params(): value = kw.get(param.name, None) - param.validate(value, self.env.context) + param.validate(value, self.env.context, supplied=param.name in kw) def verify_client_version(self, client_version): """ -- cgit