force_store_value works now with permissive
This commit is contained in:
parent
84f0095c2f
commit
712db2875e
|
@ -22,13 +22,14 @@ def make_description_freeze():
|
||||||
boolop = BoolOption('boolop', 'Test boolean option op', default=[True], multi=True)
|
boolop = BoolOption('boolop', 'Test boolean option op', default=[True], multi=True)
|
||||||
wantref_option = BoolOption('wantref', 'Test requires', default=False, properties=('force_store_value',),
|
wantref_option = BoolOption('wantref', 'Test requires', default=False, properties=('force_store_value',),
|
||||||
requires=({'option': booloption, 'expected': True, 'action': 'hidden'},))
|
requires=({'option': booloption, 'expected': True, 'action': 'hidden'},))
|
||||||
|
wantref2_option = BoolOption('wantref2', 'Test requires', default=False, properties=('force_store_value', 'hidden'))
|
||||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||||
default=False,
|
default=False,
|
||||||
requires=({'option': booloption, 'expected': True, 'action': 'hidden'},))
|
requires=({'option': booloption, 'expected': True, 'action': 'hidden'},))
|
||||||
|
|
||||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption])
|
||||||
descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption,
|
descr = OptionDescription('tiramisu', '', [gcgroup, booloption, objspaceoption,
|
||||||
wantref_option, stroption,
|
wantref_option, wantref2_option, stroption,
|
||||||
wantframework_option,
|
wantframework_option,
|
||||||
intoption, boolop])
|
intoption, boolop])
|
||||||
return descr
|
return descr
|
||||||
|
@ -153,3 +154,13 @@ def test_force_store_value_ro():
|
||||||
assert conf.getowner(conf.unwrap_from_path('wantref')) == 'default'
|
assert conf.getowner(conf.unwrap_from_path('wantref')) == 'default'
|
||||||
conf.wantref
|
conf.wantref
|
||||||
assert conf.getowner(conf.unwrap_from_path('wantref')) == 'user'
|
assert conf.getowner(conf.unwrap_from_path('wantref')) == 'user'
|
||||||
|
|
||||||
|
|
||||||
|
def test_force_store_value_hidden():
|
||||||
|
descr = make_description_freeze()
|
||||||
|
conf = Config(descr)
|
||||||
|
conf.cfgimpl_get_settings().setpermissive(('hidden',))
|
||||||
|
conf.read_write()
|
||||||
|
assert conf.getowner(conf.unwrap_from_path('wantref2')) == 'default'
|
||||||
|
conf._getattr('wantref2', force_permissive=True)
|
||||||
|
assert conf.getowner(conf.unwrap_from_path('wantref2')) == 'user'
|
||||||
|
|
|
@ -243,7 +243,8 @@ class Values(object):
|
||||||
opt.impl_validate(value, context, 'validator' in setting)
|
opt.impl_validate(value, context, 'validator' in setting)
|
||||||
if config_error is None and self._is_default_owner(path) and \
|
if config_error is None and self._is_default_owner(path) and \
|
||||||
'force_store_value' in setting[opt]:
|
'force_store_value' in setting[opt]:
|
||||||
self.setitem(opt, value, path, is_write=False)
|
self.setitem(opt, value, path, is_write=False,
|
||||||
|
force_permissive=force_permissive)
|
||||||
if validate_properties:
|
if validate_properties:
|
||||||
setting.validate_properties(opt, False, False, value=value, path=path,
|
setting.validate_properties(opt, False, False, value=value, path=path,
|
||||||
force_permissive=force_permissive,
|
force_permissive=force_permissive,
|
||||||
|
|
Loading…
Reference in New Issue