|
|
|
@ -1546,25 +1546,36 @@ class DataVars(SimpleDataVars):
|
|
|
|
|
self.Check(var,self.Get(var))
|
|
|
|
|
else:
|
|
|
|
|
val = self.fixWsdlTableValue(varObj,val)
|
|
|
|
|
if varObj.type == "choice":
|
|
|
|
|
if varObj.type in ("choice","choice-list"):
|
|
|
|
|
choicedata = self.ChoiceAndComments(var)
|
|
|
|
|
if any(choicedata):
|
|
|
|
|
if choicedata[1] is None:
|
|
|
|
|
choicedata = [choicedata[0],
|
|
|
|
|
choicedata[0]]
|
|
|
|
|
choicedata = zip(*choicedata)
|
|
|
|
|
if varObj.type == "choice":
|
|
|
|
|
vals = [val]
|
|
|
|
|
else:
|
|
|
|
|
choicedata = zip(*choicedata)
|
|
|
|
|
if not val in map(lambda x:x[0],choicedata):
|
|
|
|
|
result = filter(lambda x:(
|
|
|
|
|
_toUNICODE(val).lower() in _toUNICODE(x[0]).lower() or \
|
|
|
|
|
_toUNICODE(val).lower() in _toUNICODE(x[1]).lower()),
|
|
|
|
|
choicedata)
|
|
|
|
|
if len(result) > 1:
|
|
|
|
|
raise VariableError(_("Ambiguous choice:%s")%
|
|
|
|
|
",".join(map(lambda x:'"%s"(%s)'%(x[1],x[0]),
|
|
|
|
|
result)))
|
|
|
|
|
elif result:
|
|
|
|
|
val = result[0][0]
|
|
|
|
|
vals = val
|
|
|
|
|
res = []
|
|
|
|
|
for val in vals:
|
|
|
|
|
if not val in map(lambda x:x[0],choicedata):
|
|
|
|
|
result = filter(lambda x:(
|
|
|
|
|
_toUNICODE(val).lower() in _toUNICODE(x[0]).lower() or \
|
|
|
|
|
_toUNICODE(val).lower() in _toUNICODE(x[1]).lower()),
|
|
|
|
|
choicedata)
|
|
|
|
|
if len(result) > 1:
|
|
|
|
|
raise VariableError(_("Ambiguous choice:%s")%
|
|
|
|
|
",".join(map(
|
|
|
|
|
lambda x:'"%s"(%s)'%(x[1],x[0]) if x[0] != x[1] else x[0],
|
|
|
|
|
result)))
|
|
|
|
|
elif result:
|
|
|
|
|
val = result[0][0]
|
|
|
|
|
res.append(val)
|
|
|
|
|
if varObj.type == "choice":
|
|
|
|
|
val = res[0]
|
|
|
|
|
else:
|
|
|
|
|
val = res
|
|
|
|
|
self.Set(var,val)
|
|
|
|
|
# raise error for atempt set uncompatible variable
|
|
|
|
|
if uncomperr:
|
|
|
|
|