From 307a3a00a89f153a49780824c947936ee914acc2 Mon Sep 17 00:00:00 2001 From: gwen Date: Wed, 7 Nov 2012 17:14:50 +0100 Subject: [PATCH] permissive getattr in mandatory_warnings() --- tiramisu/config.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tiramisu/config.py b/tiramisu/config.py index ed5c881..efa2ba5 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -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 +