diff --git a/test/test_option_consistency.py b/test/test_option_consistency.py index 4db3410..a7ff41c 100644 --- a/test/test_option_consistency.py +++ b/test/test_option_consistency.py @@ -283,3 +283,14 @@ def test_consistency_not_all(): c.a = ['192.168.1.0'] c.b = ['255.255.255.0'] c.c = ['192.168.1.255'] + + +def test_consistency_permissive(): + a = IntOption('a', '', 1) + b = IntOption('b', '', 2, properties=('hidden',)) + od = OptionDescription('od', '', [a, b]) + a.impl_add_consistency('not_equal', b) + c = Config(od) + c.cfgimpl_get_settings().setpermissive(('hidden',)) + c.read_write() + c.a = 1 diff --git a/tiramisu/option.py b/tiramisu/option.py index 409d6eb..aafd43b 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -367,7 +367,8 @@ class Option(BaseOption): #if context, calculate value, otherwise get default value if context is not None: opt_value = context._getattr( - descr.impl_get_path_by_opt(opt), validate=False) + descr.impl_get_path_by_opt(opt), validate=False, + force_permissive=True) else: opt_value = opt.impl_getdefault() @@ -873,7 +874,7 @@ class PortOption(Option): if not self._min_value <= int(val) <= self._max_value: raise ValueError(_('invalid port, must be an between {0} ' 'and {1}').format(self._min_value, - self._max_value)) + self._max_value)) except ValueError: raise ValueError(_('invalid port'))