This patch makes Variable skip all validators that don't claim to support the Unset value if the validated value is indeed Unset
Signed-off-by: Zygmunt Krynicki <[email protected]> --- plainbox/plainbox/impl/secure/config.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plainbox/plainbox/impl/secure/config.py b/plainbox/plainbox/impl/secure/config.py index f651359..c4dbd69 100644 --- a/plainbox/plainbox/impl/secure/config.py +++ b/plainbox/plainbox/impl/secure/config.py @@ -168,6 +168,15 @@ class Variable(INameTracking): Tf the value was not valid in any way """ for validator in self.validator_list: + # Most validators don't want to deal with the unset type so let's + # special case that. Anything that is decorated with + # @understands_Unset will have that attribute set to True. + # + # If the value _is_ unset and the validator doesn't claim to + # support it then just skip it. + if value is Unset and not getattr(validator, 'understands_Unset', + False): + continue message = validator(self, value) if message is not None: raise ValidationError(self, value, message) -- 1.9.0 -- Mailing list: https://launchpad.net/~checkbox-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~checkbox-dev More help : https://help.launchpad.net/ListHelp

