requires needs force_permissive

This commit is contained in:
Emmanuel Garette 2018-03-31 21:17:37 +02:00
parent 790115c919
commit 95849d2e01
2 changed files with 18 additions and 0 deletions

View File

@ -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,

View File

@ -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,