|
|
|
@ -398,6 +398,8 @@ class Variable:
|
|
|
|
|
return
|
|
|
|
|
if "choice" in self.type:
|
|
|
|
|
choiceVal = self.choice()
|
|
|
|
|
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]
|
|
|
|
|
if not "list-list" in self.type:
|
|
|
|
@ -410,7 +412,7 @@ class Variable:
|
|
|
|
|
name = self.label or self.name
|
|
|
|
|
if not choiceVal:
|
|
|
|
|
self.raiseNothingValue()
|
|
|
|
|
self.raiseWrongChoice(name,choiceVal,val,error)
|
|
|
|
|
self.raiseWrongChoice(name,tipChoice,val,error)
|
|
|
|
|
|
|
|
|
|
def raiseWrongChoice(self,name,choiceVal,value,error):
|
|
|
|
|
raise VariableError(error.format(
|
|
|
|
@ -1543,6 +1545,19 @@ class DataVars(SimpleDataVars):
|
|
|
|
|
self.Check(var,self.Get(var))
|
|
|
|
|
else:
|
|
|
|
|
val = self.fixWsdlTableValue(varObj,val)
|
|
|
|
|
if varObj.type == "choice":
|
|
|
|
|
choicedata = self.ChoiceAndComments(var)
|
|
|
|
|
if any(choicedata):
|
|
|
|
|
choicedata = zip(*choicedata)
|
|
|
|
|
if not val in map(lambda x:x[0],choicedata):
|
|
|
|
|
result = filter(lambda x:val in x[0] or val in x[1],
|
|
|
|
|
choicedata)
|
|
|
|
|
if len(result) > 1:
|
|
|
|
|
raise VariableError(_("Ambigious choice:%s")%
|
|
|
|
|
",".join(map(lambda x:'"%s"(%s)'%(x[1],x[0]),
|
|
|
|
|
result)))
|
|
|
|
|
elif result:
|
|
|
|
|
val = result[0][0]
|
|
|
|
|
self.Set(var,val)
|
|
|
|
|
# raise error for atempt set uncompatible variable
|
|
|
|
|
if uncomperr:
|
|
|
|
|