Do not append default value on already defined multi slaves
authorDaniel Dehennin <daniel.dehennin@ac-dijon.fr>
Wed, 30 Jan 2013 17:03:15 +0000 (18:03 +0100)
committerDaniel Dehennin <daniel.dehennin@ac-dijon.fr>
Wed, 30 Jan 2013 17:04:55 +0000 (18:04 +0100)
* tiramisu/option.py (Multi.append): append the default value when the
  slaves have no item or lesser than the master.
  Divide looping over slaves by factor 2.

Fixes: #4799 @4h

tiramisu/option.py

index 8cb6638..540fd2e 100644 (file)
@@ -82,13 +82,14 @@ class Multi(list):
             self._setvalue(value, who=settings.get_owner())
         multis = []
         for opt in self.config._cfgimpl_descr._children:
+            if isinstance(opt, OptionDescription):
+                continue
             multi = self.config._cfgimpl_values[opt._name]
-            multis.append(multi)
-        for multi in multis:
             if master == multi.opt._name:
                 if add_master:
                     multi._setvalue(value, who=settings.get_owner())
-            else:
+            elif len(multi) == 0 \
+                 or len(multi) < len(self):
                 multi._append_default()
 
     def _append_default(self):