Do not append default value on already defined multi slaves

* 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
This commit is contained in:
Daniel Dehennin 2013-01-30 18:03:15 +01:00
parent 064bed9efa
commit 184c48db8c
1 changed files with 4 additions and 3 deletions

View File

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