better mandatory/empty support for mandatory_warnings
This commit is contained in:
@ -220,6 +220,7 @@ class MasterSlaves(object):
|
||||
# not self_properties,
|
||||
# depends to index
|
||||
#self_properties=self_properties,
|
||||
setting_properties=setting_properties,
|
||||
masterlen=masterlen,
|
||||
from_masterslave=True,
|
||||
returns_raise=True)
|
||||
|
@ -391,9 +391,13 @@ class Settings(object):
|
||||
is_cached, props = self._p_.getcache(path, ntime, index)
|
||||
if not is_cached:
|
||||
props = self._p_.getproperties(path, opt.impl_getproperties())
|
||||
if opt.impl_is_multi() and not opt.impl_is_master_slaves('slave'):
|
||||
props.add('empty')
|
||||
if apply_requires:
|
||||
props = copy(props)
|
||||
props |= self.apply_requires(opt, path, setting_properties, index)
|
||||
requires = self.apply_requires(opt, path, setting_properties, index)
|
||||
if requires != set([]):
|
||||
props = copy(props)
|
||||
props |= requires
|
||||
if 'cache' in setting_properties:
|
||||
if 'expire' in setting_properties:
|
||||
ntime = ntime + expires_time
|
||||
@ -477,9 +481,8 @@ class Settings(object):
|
||||
not self._getcontext().cfgimpl_get_values()._isempty(
|
||||
opt_or_descr, value, index=index):
|
||||
properties.remove('mandatory')
|
||||
elif opt_or_descr.impl_is_multi() and \
|
||||
elif 'empty' in properties and \
|
||||
'empty' in setting_properties and \
|
||||
not opt_or_descr.impl_is_master_slaves('slave') and \
|
||||
self._getcontext().cfgimpl_get_values()._isempty(
|
||||
opt_or_descr, value, force_allow_empty_list=True):
|
||||
properties.add('mandatory')
|
||||
@ -488,6 +491,8 @@ class Settings(object):
|
||||
properties.add('frozen')
|
||||
elif 'frozen' in properties and not check_frozen:
|
||||
properties.remove('frozen')
|
||||
if 'empty' in properties:
|
||||
properties.remove('empty')
|
||||
# at this point an option should not remain in properties
|
||||
if properties != frozenset():
|
||||
props = list(properties)
|
||||
|
@ -616,7 +616,7 @@ class Values(object):
|
||||
context = self._getcontext()
|
||||
settings = context.cfgimpl_get_settings()
|
||||
setting_properties = context.cfgimpl_get_settings()._getproperties()
|
||||
setting_properties.add('mandatory')
|
||||
setting_properties.update(['mandatory', 'empty'])
|
||||
|
||||
def _mandatory_warnings(description, currpath=None):
|
||||
if currpath is None:
|
||||
@ -638,7 +638,7 @@ class Values(object):
|
||||
self_properties = settings._getproperties(opt, path,
|
||||
read_write=False,
|
||||
setting_properties=setting_properties)
|
||||
if 'mandatory' in self_properties:
|
||||
if 'mandatory' in self_properties or 'empty' in self_properties:
|
||||
err = self._get_cached_value(opt, path=path,
|
||||
trusted_cached_properties=False,
|
||||
force_permissive=force_permissive,
|
||||
|
Reference in New Issue
Block a user