permissive getattr in mandatory_warnings()

This commit is contained in:
gwen 2012-11-07 17:14:50 +01:00
parent bfb5045753
commit 307a3a00a8
1 changed files with 3 additions and 10 deletions

View File

@ -188,7 +188,7 @@ class Config(object):
not isinstance(opt_or_descr, OptionDescription):
raise TypeError('Unexpected object: {0}'.format(repr(opt_or_descr)))
properties = copy(opt_or_descr.properties)
for proper in properties:
for proper in copy(properties):
if not self._cfgimpl_toplevel._cfgimpl_has_property(proper):
properties.remove(proper)
if permissive:
@ -744,17 +744,10 @@ def mandatory_warnings(config):
config._cfgimpl_get_toplevel()._cfgimpl_mandatory = True
for path in config._cfgimpl_descr.getpaths(include_groups=True):
try:
if '.' in path:
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)
value = config._getattr(path, permissive=True)
except MandatoryError:
yield path
except PropertiesOptionError:
pass
config._cfgimpl_get_toplevel()._cfgimpl_mandatory = mandatory