diff --git a/tiramisu/value.py b/tiramisu/value.py index f6a71f4..237dd7c 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -80,12 +80,27 @@ class Values(object): "convenience method to know if an option is empty" if value is not None: return False - if (not opt.is_multi() and self._get_value(opt) == None) or \ - (opt.is_multi() and (self._get_value(opt) == [] or \ + if (not opt.is_multi() and value == None) or \ + (opt.is_multi() and (value == [] or \ None in self._get_value(opt))): return True return False + def is_empty(self, opt): + if opt not in self.values: + return True + value = self.values[opt] + if not opt.is_multi(): + if self._get_value(opt) == None: + return True + return False + else: + value = list(value) + for val in value: + if val != None: + return False + return True + def _test_mandatory(self, opt, value=None): # mandatory options mandatory = self.context._cfgimpl_settings.mandatory