|
|
|
@ -394,13 +394,13 @@ class Variable:
|
|
|
|
|
if "list" in self.type:
|
|
|
|
|
if not type(value) in (list,tuple):
|
|
|
|
|
raise VariableError(
|
|
|
|
|
_("Value for variable '{varname}' may be '{vartype}' only").format(
|
|
|
|
|
_("Value for variable '{varname}' may be {vartype} only").format(
|
|
|
|
|
varname=self.label or self.name,
|
|
|
|
|
vartype="list"))
|
|
|
|
|
error = _("Values for variable '{varname}' may be '{vartype}' only")
|
|
|
|
|
error = _("Values for variable '{varname}' may be {vartype} only")
|
|
|
|
|
else:
|
|
|
|
|
value = repeat(value,1)
|
|
|
|
|
error = _("Value for variable '{varname}' may be '{vartype}' only")
|
|
|
|
|
error = _("Value for variable '{varname}' may be {vartype} only")
|
|
|
|
|
if "string" in self.type:
|
|
|
|
|
value, valuecopy = tee(value,2)
|
|
|
|
|
for v in (x for x in valuecopy if not type(x) in (str,unicode)):
|
|
|
|
@ -410,7 +410,7 @@ class Variable:
|
|
|
|
|
return
|
|
|
|
|
if "choice" in self.type:
|
|
|
|
|
choiceVal = self.choice()
|
|
|
|
|
tipChoice = map(lambda x:'"%s"(%s)'%(x[1],x[0]) \
|
|
|
|
|
tipChoice = map(lambda x:'"%s" [%s]'%(x[1],x[0]) \
|
|
|
|
|
if type(x) in (list,tuple) else str(x), choiceVal)
|
|
|
|
|
if choiceVal and type(choiceVal[0]) in (tuple,list):
|
|
|
|
|
choiceVal = [x[0] for x in choiceVal]
|
|
|
|
@ -418,10 +418,19 @@ class Variable:
|
|
|
|
|
value = repeat(value,1)
|
|
|
|
|
for recval in value:
|
|
|
|
|
for val in recval:
|
|
|
|
|
name = self.label or self.name
|
|
|
|
|
if val == "list" and "choice" in self.type:
|
|
|
|
|
if "edit" in self.type:
|
|
|
|
|
if "list" in self.type:
|
|
|
|
|
error = _("Values for variable '{varname}' may "
|
|
|
|
|
"be {vartype}")
|
|
|
|
|
else:
|
|
|
|
|
error = _("Value for variable '{varname}' may be "
|
|
|
|
|
"{vartype}")
|
|
|
|
|
self.raiseWrongChoice(name, tipChoice, val, error)
|
|
|
|
|
if "choice" in self.type and not "choiceedit" in self.type:
|
|
|
|
|
if choiceVal and val and not val in choiceVal or \
|
|
|
|
|
val is None:
|
|
|
|
|
name = self.label or self.name
|
|
|
|
|
if not choiceVal:
|
|
|
|
|
self.raiseNothingValue()
|
|
|
|
|
self.raiseWrongChoice(name,tipChoice,val,error)
|
|
|
|
|