support of non multi variable
authorEmmanuel Garette <egarette@cadoles.com>
Tue, 11 Jun 2013 13:31:20 +0000 (15:31 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Tue, 11 Jun 2013 13:31:20 +0000 (15:31 +0200)
tiramisu/value.py

index 9e65db2..e90e59c 100644 (file)
@@ -121,7 +121,7 @@ class Values(object):
                                         (is_frozen and
                                          'force_default_on_freeze' in setting[opt])):
             no_value_slave = False
-            if opt.impl_get_multitype() == multitypes.slave:
+            if opt.impl_is_multi() and opt.impl_get_multitype() == multitypes.slave:
                 masterp = self.context.cfgimpl_get_description().impl_get_path_by_opt(
                     opt.impl_get_master_slaves())
                 mastervalue = getattr(self.context, masterp)
@@ -132,13 +132,12 @@ class Values(object):
 
             if not no_value_slave:
                 value = self._getcallback_value(opt)
-                if opt.impl_is_multi():
-                    if opt.impl_get_multitype() == multitypes.slave:
-                        if isinstance(value, list):
-                            raise ValueError('callback must not return list '
-                                            'in slave {0}: {1}'.format(opt._name,
-                                                                        value))
-                        value = [value for i in range(lenmaster)]
+                if opt.impl_is_multi() and opt.impl_get_multitype() == multitypes.slave:
+                    if isinstance(value, list):
+                        raise ValueError('callback must not return list '
+                                         'in slave {0}: {1}'.format(opt._name,
+                                                                    value))
+                    value = [value for i in range(lenmaster)]
             if opt.impl_is_multi():
                 value = Multi(value, self.context, opt, validate)
             #suppress value if already set