Arity change, remove force_properties:
[tiramisu.git] / tiramisu / value.py
index 47e74b6..9b954a5 100644 (file)
@@ -22,7 +22,7 @@ from tiramisu.error import ConfigError, SlaveError, PropertiesOptionError
 from tiramisu.setting import owners, expires_time, undefined
 from tiramisu.autolib import carry_out_calculation
 from tiramisu.i18n import _
-from tiramisu.option import SymLinkOption
+from tiramisu.option import SymLinkOption, OptionDescription
 
 
 class Values(object):
@@ -170,13 +170,11 @@ class Values(object):
         "enables us to use the pythonic dictionary-like access to values"
         return self.getitem(opt)
 
-    def getitem(self, opt, validate=True, force_permissive=False,
-                force_properties=None):
+    def getitem(self, opt, validate=True, force_permissive=False):
         """
         """
         return self._get_cached_item(opt, validate=validate,
-                                     force_permissive=force_permissive,
-                                     force_properties=force_properties)
+                                     force_permissive=force_permissive)
 
     def _get_cached_item(self, opt, path=None, validate=True,
                          force_permissive=False, force_properties=None,
@@ -296,7 +294,6 @@ class Values(object):
                        is_write=is_write)
 
     def _setvalue(self, opt, path, value, force_permissive=False,
-                  force_properties=None,
                   is_write=True, validate_properties=True):
         context = self._getcontext()
         context.cfgimpl_reset_cache()
@@ -304,8 +301,7 @@ class Values(object):
             setting = context.cfgimpl_get_settings()
             setting.validate_properties(opt, False, is_write,
                                         value=value, path=path,
-                                        force_permissive=force_permissive,
-                                        force_properties=force_properties)
+                                        force_permissive=force_permissive)
         owner = context.cfgimpl_get_settings().getowner()
         if isinstance(value, Multi):
             value = list(value)
@@ -421,18 +417,26 @@ class Values(object):
         :returns: generator of mandatory Option's path
 
         """
-        #if value in cache, properties are not calculated
+        def _mandatory_warnings(description):
+            #if value in cache, properties are not calculated
+            for opt in description.impl_getchildren():
+                if isinstance(opt, OptionDescription):
+                    _mandatory_warnings(opt)
+                elif isinstance(opt, SymLinkOption):
+                    pass
+                else:
+                    path = self._get_opt_path(opt)
+                    try:
+                        self._get_cached_item(opt, path=path,
+                                              force_properties=frozenset(('mandatory',)))
+                    except PropertiesOptionError as err:
+                        if err.proptype == ['mandatory']:
+                            yield path
         self.reset_cache(False)
-        context = self.context()
-        for path in context.cfgimpl_get_description().impl_getpaths(
-                include_groups=True):
-            try:
-                context.getattr(path,
-                                force_properties=frozenset(('mandatory',)))
-            except PropertiesOptionError as err:
-                if err.proptype == ['mandatory']:
-                    yield path
+        descr = self._getcontext().cfgimpl_get_description()
+        ret = list(_mandatory_warnings(descr))
         self.reset_cache(False)
+        return ret
 
     def force_cache(self):
         """parse all option to force data in cache