Skip to content

Commit e56bb39

Browse files
author
Josh Schindehette
authored
Fixed issue with parsing the type of a simple sequence in a struct (#3)
1 parent 009ea65 commit e56bb39

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

rest/helper.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,27 @@ def __any_simple_seq(corba_any):
223223
'value': []
224224
}
225225
for a in corba_any.value.value():
226-
if ret['type'] == '':
227-
ret['type'] = PropertyHelper.__corba_to_cf_type(a.value._t)
228-
ret['value'].append(a.value.value())
226+
if hasattr(a, 'value'):
227+
# The item in the sequence is a CORBA type
228+
if ret['type'] == '':
229+
ret['type'] = PropertyHelper.__corba_to_cf_type(a.value._t)
230+
ret['value'].append(a.value.value())
231+
else:
232+
# The item in the sequence is a Python type
233+
if ret['type'] == '':
234+
# Convert to CF type
235+
aType = str(type(a))
236+
if 'str' in aType:
237+
ret['type'] = 'string'
238+
elif ('int' in aType) or ('long' in aType):
239+
ret['type'] = 'long'
240+
elif 'float' in aType:
241+
ret['type'] = 'double'
242+
elif 'bool' in aType:
243+
ret['type'] = 'boolean'
244+
else:
245+
ret['type'] = aType
246+
ret['value'].append(a)
229247
return ret
230248

231249
@staticmethod

0 commit comments

Comments
 (0)