numbers can be converted to string for text input and enum

This commit is contained in:
iLLiCiTiT 2021-03-23 17:13:00 +01:00
parent b940d3ba9d
commit 57447f2bfc
2 changed files with 8 additions and 0 deletions

View file

@ -50,6 +50,8 @@ class EnumEntity(InputEntity):
if self.multiselection:
if isinstance(value, (set, tuple)):
return list(value)
elif isinstance(value, (int, float)):
return str(value)
return NOT_SET
def set(self, value):

View file

@ -369,6 +369,12 @@ class TextEntity(InputEntity):
self.multiline = self.schema_data.get("multiline", False)
self.placeholder_text = self.schema_data.get("placeholder")
def _convert_to_valid_type(self, value):
# Allow numbers converted to string
if isinstance(value, (int, float)):
return str(value)
return NOT_SET
class PathInput(InputEntity):
schema_types = ["path-input"]