refactor validation
[tiramisu.git] / tiramisu / autolib.py
index 44bb82e..9096f8b 100644 (file)
@@ -24,12 +24,12 @@ from tiramisu.setting import undefined
 # ____________________________________________________________
 
 
-def carry_out_calculation(option, config, callback, callback_params,
+def carry_out_calculation(option, context, callback, callback_params,
                           index=undefined):
     """a function that carries out a calculation for an option's value
 
     :param option: the option
-    :param config: the context config in order to have
+    :param context: the context config in order to have
                    the whole options available
     :param callback: the name of the callback function
     :type callback: str
@@ -147,26 +147,26 @@ def carry_out_calculation(option, config, callback, callback_params,
     for key, callbacks in callback_params.items():
         for callbk in callbacks:
             if isinstance(callbk, tuple):
-                if config is undefined:
+                if context is undefined:
                     raise ContextError()  # pragma: optional cover
                 if callbk[0] is None:  # pragma: optional cover
                     #Not an option, set full context
-                    tcparams.setdefault(key, []).append((config, False))
+                    tcparams.setdefault(key, []).append((context, False))
                 else:
                     # callbk is something link (opt, True|False)
                     opt, force_permissive = callbk
                     if opt._is_subdyn():
-                        root = '.'.join(option.impl_getpath(config).split('.')[:-1])
+                        root = '.'.join(option.impl_getpath(context).split('.')[:-1])
                         name = opt.impl_getname() + option.impl_getsuffix()
                         path = root + '.' + name
                         opt = opt._impl_to_dyn(name, path)
                     else:
-                        path = config.cfgimpl_get_description(
+                        path = context.cfgimpl_get_description(
                         ).impl_get_path_by_opt(opt)
                     # get value
                     try:
-                        value = config.getattr(path, force_permissive=True,
-                                               validate=False)
+                        value = context.getattr(path, force_permissive=True,
+                                                validate=False)
                         # convert to list, not modifie this multi
                         if value.__class__.__name__ == 'Multi':
                             value = list(value)