|
|
@ -377,7 +377,8 @@ class Variable:
|
|
|
|
"""Check value for type"""
|
|
|
|
"""Check value for type"""
|
|
|
|
if "int" in self.type:
|
|
|
|
if "int" in self.type:
|
|
|
|
if value and not value.isdigit():
|
|
|
|
if value and not value.isdigit():
|
|
|
|
raise VariableError(_("Value of variable '{varname}' must be integer"
|
|
|
|
raise VariableError(
|
|
|
|
|
|
|
|
_("Value of variable '{varname}' must be integer"
|
|
|
|
).format(varname=self.label or self.name))
|
|
|
|
).format(varname=self.label or self.name))
|
|
|
|
if "list" in self.type:
|
|
|
|
if "list" in self.type:
|
|
|
|
if not type(value) in (list,tuple):
|
|
|
|
if not type(value) in (list,tuple):
|
|
|
@ -385,10 +386,10 @@ class Variable:
|
|
|
|
_("Value for variable '{varname}' may be '{vartype}' only").format(
|
|
|
|
_("Value for variable '{varname}' may be '{vartype}' only").format(
|
|
|
|
varname=self.label or self.name,
|
|
|
|
varname=self.label or self.name,
|
|
|
|
vartype="list"))
|
|
|
|
vartype="list"))
|
|
|
|
error = _("Values for variable '{varname}' may be {vartype} only")
|
|
|
|
error = _("Values for variable '{varname}' may be '{vartype}' only")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
value = repeat(value,1)
|
|
|
|
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:
|
|
|
|
if "string" in self.type:
|
|
|
|
value, valuecopy = tee(value,2)
|
|
|
|
value, valuecopy = tee(value,2)
|
|
|
|
for v in (x for x in valuecopy if not type(x) in (str,unicode)):
|
|
|
|
for v in (x for x in valuecopy if not type(x) in (str,unicode)):
|
|
|
@ -1555,7 +1556,7 @@ class DataVars(SimpleDataVars):
|
|
|
|
_toUNICODE(val).lower() in _toUNICODE(x[1]).lower()),
|
|
|
|
_toUNICODE(val).lower() in _toUNICODE(x[1]).lower()),
|
|
|
|
choicedata)
|
|
|
|
choicedata)
|
|
|
|
if len(result) > 1:
|
|
|
|
if len(result) > 1:
|
|
|
|
raise VariableError(_("Ambigious choice:%s")%
|
|
|
|
raise VariableError(_("Ambiguous choice:%s")%
|
|
|
|
",".join(map(lambda x:'"%s"(%s)'%(x[1],x[0]),
|
|
|
|
",".join(map(lambda x:'"%s"(%s)'%(x[1],x[0]),
|
|
|
|
result)))
|
|
|
|
result)))
|
|
|
|
elif result:
|
|
|
|
elif result:
|
|
|
|