fix enum when SEA type is text
Change-Id: I873045a2dac8771b844431ccda70ce1b8ff1aee5
This commit is contained in:
parent
f6868da3b9
commit
5a456a82b0
@ -383,6 +383,19 @@ SEA_TO_SECOPTYPE = {
|
||||
}
|
||||
|
||||
|
||||
class SeaEnum(EnumType):
|
||||
"""some sea enum nodes have text type -> accept '<integer>' also"""
|
||||
def copy(self):
|
||||
return SeaEnum(self._enum)
|
||||
|
||||
def __call__(self, value):
|
||||
try:
|
||||
value = int(value)
|
||||
except TypeError:
|
||||
pass
|
||||
return super().__call__(value)
|
||||
|
||||
|
||||
def get_datatype(paramdesc):
|
||||
typ = paramdesc['type']
|
||||
result = SEA_TO_SECOPTYPE.get(typ, False)
|
||||
@ -390,7 +403,7 @@ def get_datatype(paramdesc):
|
||||
return result
|
||||
# special cases
|
||||
if typ == 'enum':
|
||||
return EnumType(paramdesc['enum'])
|
||||
return SeaEnum(paramdesc['enum'])
|
||||
raise ValueError('unknown SEA type %r' % typ)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user