Skip to content

Commit 3a906e7

Browse files
author
Thomas Goodwin
committed
More robust handling of converting incoming property maps back to their correct data types
1 parent d7ca955 commit 3a906e7

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

model/redhawk.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
Asynchronous Tornado service for REDHAWK. Maps the functions
2424
in domain.py and caches the domain object.
2525
"""
26-
26+
import logging
2727
from _utils.tasking import background_task
2828

2929
from domain import Domain, scan_domains, ResourceNotFound
3030

3131
from ossie.properties import __TYPE_MAP as TYPE_MAP
32-
from ossie.properties import props_from_dict
32+
from ossie.properties import props_from_dict, props_to_dict
3333

3434
from tornado.websocket import WebSocketClosedError
3535
from tornado import ioloop
@@ -200,13 +200,17 @@ def _clean_property(property):
200200
return property
201201

202202
@staticmethod
203+
# CF.Properties and dict() of { 'id': value, ... }
203204
def _get_prop_changes(current_props, new_properties):
204205
changes = {}
205206
for prop in current_props:
206207
if prop.id in new_properties:
207208
if new_properties[prop.id] != prop.queryValue():
208-
TYPE = TYPE_MAP.get(prop.type, [type(prop.queryValue())])
209-
changes[str(prop.id)] = (TYPE[0]) (Redhawk._clean_property(new_properties[prop.id]))
209+
changes[str(prop.id)] = prop.fromAny(
210+
prop.toAny(
211+
Redhawk._clean_property(new_properties[prop.id])
212+
)
213+
)
210214
return props_from_dict(changes)
211215

212216
##############################

0 commit comments

Comments
 (0)