NoValueReturn is not needed now + apply_requires is now in settings
[tiramisu.git] / tiramisu / config.py
index d0b870c..306f69b 100644 (file)
@@ -23,8 +23,7 @@
 #from inspect import getmembers, ismethod
 from tiramisu.error import (PropertiesOptionError, NotFoundError,
                             AmbigousOptionError, NoMatchingOptionFound, MandatoryError)
-from tiramisu.option import (OptionDescription, Option, SymLinkOption,
-                             apply_requires)
+from tiramisu.option import OptionDescription, Option, SymLinkOption
 from tiramisu.setting import groups, Setting
 from tiramisu.value import Values
 
@@ -78,7 +77,6 @@ class SubConfig(object):
 
     def _validate(self, name, opt_or_descr, force_permissive=False):
         "validation for the setattr and the getattr"
-        apply_requires(opt_or_descr, self)
         if not isinstance(opt_or_descr, Option) and \
                 not isinstance(opt_or_descr, OptionDescription):
             raise TypeError('Unexpected object: {0}'.format(repr(opt_or_descr)))
@@ -87,7 +85,7 @@ class SubConfig(object):
         properties = properties - set(['mandatory', 'frozen'])
         set_properties = set(self.cfgimpl_get_settings().get_properties())
         properties = properties & set_properties
-        if force_permissive is True or self.cfgimpl_get_settings().has_property('permissive'):
+        if force_permissive is True or self.cfgimpl_get_settings().has_property('permissive', is_apply_req=False):
             properties = properties - set(self.cfgimpl_get_settings().get_permissive())
         properties = properties - set(self.cfgimpl_get_settings().get_permissive(opt_or_descr))
         properties = list(properties)
@@ -306,9 +304,13 @@ class SubConfig(object):
             raise ValueError("make_dict can't filtering with value without option")
         if withoption is not None:
             mypath = self.getpath()
-            for path in self.cfgimpl_get_context()._find(bytype=Option, byname=withoption,
-                                                         byvalue=withvalue, byattrs=None,
-                                                         first=False, ret='path', _subpath=mypath):
+            for path in self.cfgimpl_get_context()._find(bytype=Option,
+                                                         byname=withoption,
+                                                         byvalue=withvalue,
+                                                         byattrs=None,
+                                                         first=False,
+                                                         type_='path',
+                                                         _subpath=mypath):
                 path = '.'.join(path.split('.')[:-1])
                 opt = self.cfgimpl_get_context().cfgimpl_get_description().get_opt_by_path(path)
                 if mypath is not None:
@@ -362,7 +364,7 @@ class Config(SubConfig):
         :param context: the current root config
         :type context: `Config`
         """
-        self._cfgimpl_settings = Setting()
+        self._cfgimpl_settings = Setting(self)
         self._cfgimpl_values = Values(self)
         super(Config, self).__init__(descr, self)  # , slots)
         self._cfgimpl_build_all_paths()
@@ -390,6 +392,7 @@ class Config(SubConfig):
 
         :param kwargs: dict of name strings to values.
         """
+        #opts, paths = self.cfgimpl_get_description()._cache_paths
         all_paths = [p.split(".") for p in self.getpaths(allpaths=True)]
         for key, value in kwargs.iteritems():
             key_p = key.split('.')