support of non multi variable

This commit is contained in:
Emmanuel Garette 2013-06-11 15:31:20 +02:00
parent 6d1cf308b2
commit b2538f6f0b
1 changed files with 7 additions and 8 deletions

View 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