permissive getattr in mandatory_warnings()
This commit is contained in:
parent
bfb5045753
commit
307a3a00a8
@ -188,7 +188,7 @@ class Config(object):
|
|||||||
not isinstance(opt_or_descr, OptionDescription):
|
not isinstance(opt_or_descr, OptionDescription):
|
||||||
raise TypeError('Unexpected object: {0}'.format(repr(opt_or_descr)))
|
raise TypeError('Unexpected object: {0}'.format(repr(opt_or_descr)))
|
||||||
properties = copy(opt_or_descr.properties)
|
properties = copy(opt_or_descr.properties)
|
||||||
for proper in properties:
|
for proper in copy(properties):
|
||||||
if not self._cfgimpl_toplevel._cfgimpl_has_property(proper):
|
if not self._cfgimpl_toplevel._cfgimpl_has_property(proper):
|
||||||
properties.remove(proper)
|
properties.remove(proper)
|
||||||
if permissive:
|
if permissive:
|
||||||
@ -744,17 +744,10 @@ def mandatory_warnings(config):
|
|||||||
config._cfgimpl_get_toplevel()._cfgimpl_mandatory = True
|
config._cfgimpl_get_toplevel()._cfgimpl_mandatory = True
|
||||||
for path in config._cfgimpl_descr.getpaths(include_groups=True):
|
for path in config._cfgimpl_descr.getpaths(include_groups=True):
|
||||||
try:
|
try:
|
||||||
if '.' in path:
|
value = config._getattr(path, permissive=True)
|
||||||
homeconfig, path = config._cfgimpl_get_home_by_path(path)
|
|
||||||
else:
|
|
||||||
homeconfig = config
|
|
||||||
opt = getattr(homeconfig._cfgimpl_descr, path)
|
|
||||||
#for PropertiesOptionError
|
|
||||||
homeconfig._validate(path, opt)
|
|
||||||
if not isinstance(opt, OptionDescription):
|
|
||||||
homeconfig._test_mandatory(path, opt)
|
|
||||||
except MandatoryError:
|
except MandatoryError:
|
||||||
yield path
|
yield path
|
||||||
except PropertiesOptionError:
|
except PropertiesOptionError:
|
||||||
pass
|
pass
|
||||||
config._cfgimpl_get_toplevel()._cfgimpl_mandatory = mandatory
|
config._cfgimpl_get_toplevel()._cfgimpl_mandatory = mandatory
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user