mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
[desc] Choice: cast input value to expected type when validating value
This commit is contained in:
parent
8539c2817b
commit
ccaac43b34
1 changed files with 2 additions and 0 deletions
|
@ -154,6 +154,8 @@ class ChoiceParam(Param):
|
||||||
raise ValueError('Non exclusive ChoiceParam value "{}" should be iterable.'.format(value))
|
raise ValueError('Non exclusive ChoiceParam value "{}" should be iterable.'.format(value))
|
||||||
newValues = value
|
newValues = value
|
||||||
for newValue in newValues:
|
for newValue in newValues:
|
||||||
|
t = type(self._values[0]) # cast to value type
|
||||||
|
newValue = t(newValue)
|
||||||
if newValue not in self.values:
|
if newValue not in self.values:
|
||||||
raise ValueError('ChoiceParam value "{}" is not in "{}".'.format(newValue, str(self.values)))
|
raise ValueError('ChoiceParam value "{}" is not in "{}".'.format(newValue, str(self.values)))
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue