Merge branch 'master' of ssh://git.labs.libre-entreprise.org/gitroot/tiramisu
authorgwen <gremond@cadoles.com>
Wed, 4 Sep 2013 07:05:25 +0000 (09:05 +0200)
committergwen <gremond@cadoles.com>
Wed, 4 Sep 2013 07:05:25 +0000 (09:05 +0200)
1  2 
tiramisu/option.py

@@@ -168,29 -167,37 +168,43 @@@ class BaseOption(object)
                  consistencies = self._state_consistencies
              else:
                  consistencies = self._consistencies
-             new_value = []
-             for consistency in consistencies:
-                 if load:
-                     new_value.append((consistency[0],
-                                       descr.impl_get_opt_by_path(
-                                           consistency[1])))
-                 else:
-                     new_value.append((consistency[0],
-                                       descr.impl_get_path_by_opt(
-                                           consistency[1])))
+             if isinstance(consistencies, list):
+                 new_value = []
+                 for consistency in consistencies:
+                     if load:
+                         new_value.append((consistency[0],
+                                           descr.impl_get_opt_by_path(
+                                               consistency[1])))
+                     else:
+                         new_value.append((consistency[0],
+                                           descr.impl_get_path_by_opt(
+                                               consistency[1])))
+             else:
+                 new_value = {}
+                 for key, _consistencies in consistencies.items():
+                     new_value[key] = []
+                     for key_cons, _cons in _consistencies:
+                         _list_cons = []
+                         for _con in _cons:
+                             if load:
+                                 _list_cons.append(descr.impl_get_opt_by_path(_con))
+                             else:
+                                 _list_cons.append(descr.impl_get_path_by_opt(_con))
+                         new_value[key].append((key_cons, tuple(_list_cons)))
              if load:
                  del(self._state_consistencies)
-                 self._consistencies = tuple(new_value)
+                 self._consistencies = new_value
              else:
-                 self._state_consistencies = tuple(new_value)
+                 self._state_consistencies = new_value
  
      def _impl_convert_requires(self, descr, load=False):
 +        """export of the requires during the serialization process
 +
 +        :type descr: :class:`tiramisu.option.OptionDescription`
 +        :param load: `True` if we are at the init of the option description
 +        :type load: bool
 +        """
          if not load and self._requires is None:
              self._state_requires = None
          elif load and self._state_requires is None: