|
hi,
we've been working on upgrading our system to Tango 9 (from 8) and found a sort of regression in the way of device property initialization.
In PyTango 8 the initialization of Tango properties was as follows
def __DeviceImpl__get_device_properties(self, ds_class = None):
if ds_class is None:
try:
# Call this method in a try/except in case this is called during the DS shutdown sequence
ds_class = self.get_device_class()
except:
return
try:
pu = self.prop_util = ds_class.prop_util
self.device_property_list = copy.deepcopy(ds_class.device_property_list)
class_prop = ds_class.class_property_list
pu.get_device_properties(self, class_prop, self.device_property_list)
for prop_name in class_prop:
setattr(self, prop_name, pu.get_property_values(prop_name, class_prop))
for prop_name in self.device_property_list:
setattr(self, prop_name, self.prop_util.get_property_values(prop_name, self.device_property_list))
except DevFailed as df:
print(80*"-")
print(df)
raise df
In PyTango 9 the same code is here:
def get_device_properties(self, ds_class = None):
if ds_class is None:
try:
# Call this method in a try/except in case this is called during
# the DS shutdown sequence
ds_class = self.get_device_class()
except:
return
try:
pu = self.prop_util = ds_class.prop_util
self.device_property_list = copy.deepcopy(ds_class.device_property_list)
class_prop = ds_class.class_property_list
pu.get_device_properties(self, class_prop, self.device_property_list)
for prop_name in class_prop:
value = pu.get_property_values(prop_name, class_prop)
self._tango_properties[prop_name] = value
for prop_name in self.device_property_list:
value = self.prop_util.get_property_values(prop_name,
self.device_property_list)
self._tango_properties[prop_name] = value
except DevFailed as df:
print(80*"-")
print(df)
raise df
The only difference is the assignment of the property value: in the new version, the internal dictionary of properties is set directly while the old version will call the setter (__set__ method of device_property) of the associated device_property.
This led to an issue in our Tango-based system because we have specialized the device_property descriptor (by subclassing) in order to perform some extra code when a property is being set.
Any chance to fall back to the original solution?
Thanks in advance, Gergely
|