From e515ec145dd738db3677c55174d5e28dde36f159 Mon Sep 17 00:00:00 2001 From: gwen Date: Tue, 26 Feb 2013 16:58:44 +0100 Subject: [PATCH] type shall not be a list --- tiramisu/value.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tiramisu/value.py b/tiramisu/value.py index d62d558..282c996 100644 --- a/tiramisu/value.py +++ b/tiramisu/value.py @@ -79,6 +79,8 @@ class Values(object): def get_previous_value(self, opt): if opt in self.previous_values: prec_value = self.previous_values[opt] + elif opt.is_multi(): + prec_value = [] else: prec_value = None return prec_value @@ -180,10 +182,16 @@ class Values(object): raise MultiTypeError("invalid len for the slave: {0}" " which has {1} as master".format(opt._name, self.slaves[opt]._name)) + elif opt.is_multi(): + if not isinstance(value, Multi): + value = Multi(value, self.context, opt, multitypes.default) self.setitem(opt, value) def setitem(self, opt, value): self.set_previous_value(opt) + if type(value) == list: + raise MultiTypeError("the type of the value {0} which is multi shall " + "be Multi and not list".format(str(value))) self.values[opt] = value self.setowner(opt, self.context._cfgimpl_settings.getowner())