From 95849d2e013f69e3f66a86aa1ffe84022484cdaf Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 31 Mar 2018 21:17:37 +0200 Subject: [PATCH] requires needs force_permissive --- test/test_requires.py | 17 +++++++++++++++++ tiramisu/setting.py | 1 + 2 files changed, 18 insertions(+) diff --git a/test/test_requires.py b/test/test_requires.py index ada4dc5..0561185 100644 --- a/test/test_requires.py +++ b/test/test_requires.py @@ -301,6 +301,23 @@ def test_requires_transitive_bis(): assert frozenset(props) == frozenset(['disabled']) +def test_requires_transitive_hidden_permissive(): + a = BoolOption('activate_service', '', True) + b = BoolOption('activate_service_web', '', True, + requires=[{'option': a, 'expected': False, 'action': 'hidden'}]) + d = IPOption('ip_address_service_web', '', + requires=[{'option': b, 'expected': False, 'action': 'disabled'}]) + od = OptionDescription('service', '', [a, b, d]) + api = getapi(Config(od)) + api.property.read_write() + api.option('activate_service').value.get() + api.option('ip_address_service_web').value.get() + api.option('ip_address_service_web').value.get() + api.option('activate_service').value.set(False) + # + api.option('ip_address_service_web').value.get() + + def test_requires_transitive_hidden_disabled(): a = BoolOption('activate_service', '', True) b = BoolOption('activate_service_web', '', True, diff --git a/tiramisu/setting.py b/tiramisu/setting.py index 6115163..bb9c34f 100644 --- a/tiramisu/setting.py +++ b/tiramisu/setting.py @@ -486,6 +486,7 @@ class Settings(object): is_indexed = True sconfig_bag = config_bag.copy('nooption') sconfig_bag.option = option + sconfig_bag.force_permissive = True try: value = context.getattr(reqpath, idx,