properties option in consistencies are now allowed
authorEmmanuel Garette <egarette@cadoles.com>
Thu, 6 Feb 2014 18:19:48 +0000 (19:19 +0100)
committerDaniel Dehennin <daniel.dehennin@ac-dijon.fr>
Mon, 17 Feb 2014 16:45:37 +0000 (17:45 +0100)
Conflicts:
tiramisu/option.py (PortOption._validate): Strange try/except
removed.

test/test_option_consistency.py
tiramisu/option.py

index 4db3410..a7ff41c 100644 (file)
@@ -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
index ad99416..9df3d01 100644 (file)
@@ -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()