permissive getattr in mandatory_warnings()
authorgwen <gremond@cadoles.com>
Wed, 7 Nov 2012 16:14:50 +0000 (17:14 +0100)
committergwen <gremond@cadoles.com>
Wed, 7 Nov 2012 16:14:50 +0000 (17:14 +0100)
tiramisu/config.py

index ed5c881..efa2ba5 100644 (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
+