type shall not be a list
This commit is contained in:
parent
151bc83ba5
commit
e515ec145d
1 changed files with 8 additions and 0 deletions
|
@ -79,6 +79,8 @@ class Values(object):
|
||||||
def get_previous_value(self, opt):
|
def get_previous_value(self, opt):
|
||||||
if opt in self.previous_values:
|
if opt in self.previous_values:
|
||||||
prec_value = self.previous_values[opt]
|
prec_value = self.previous_values[opt]
|
||||||
|
elif opt.is_multi():
|
||||||
|
prec_value = []
|
||||||
else:
|
else:
|
||||||
prec_value = None
|
prec_value = None
|
||||||
return prec_value
|
return prec_value
|
||||||
|
@ -180,10 +182,16 @@ class Values(object):
|
||||||
raise MultiTypeError("invalid len for the slave: {0}"
|
raise MultiTypeError("invalid len for the slave: {0}"
|
||||||
" which has {1} as master".format(opt._name,
|
" which has {1} as master".format(opt._name,
|
||||||
self.slaves[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)
|
self.setitem(opt, value)
|
||||||
|
|
||||||
def setitem(self, opt, value):
|
def setitem(self, opt, value):
|
||||||
self.set_previous_value(opt)
|
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.values[opt] = value
|
||||||
self.setowner(opt, self.context._cfgimpl_settings.getowner())
|
self.setowner(opt, self.context._cfgimpl_settings.getowner())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue