[pytango] 474/483: Make sure old and new style servers don't mix

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:15:14 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit b66836f8d1b1a45ed680a5228005ebaea32bc285
Author: coutinho <coutinho at esrf.fr>
Date:   Wed Apr 22 16:08:23 2015 +0200

    Make sure old and new style servers don't mix
---
 src/boost/python/device_server.py | 16 ++++------------
 src/boost/python/server.py        | 30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/src/boost/python/device_server.py b/src/boost/python/device_server.py
index e71a49b..068b567 100644
--- a/src/boost/python/device_server.py
+++ b/src/boost/python/device_server.py
@@ -292,18 +292,10 @@ def __DeviceImpl__get_device_properties(self, ds_class = None):
         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)
-        if hasattr(self, "_tango_properties"):
-            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
-        else:
-            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))
+        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)
diff --git a/src/boost/python/server.py b/src/boost/python/server.py
index 2ca26ff..8d21a9d 100644
--- a/src/boost/python/server.py
+++ b/src/boost/python/server.py
@@ -21,6 +21,7 @@ __all__ = ["DeviceMeta", "Device", "LatestDeviceImpl", "attribute",
 
 import os
 import sys
+import copy
 import types
 import inspect
 import logging
@@ -436,6 +437,35 @@ class Device(LatestDeviceImpl):
         :meth:`get_device_properties`"""
         self.get_device_properties()
 
+    def delete_device(self):
+        pass
+    delete_device.__doc__ == LatestDeviceImpl.delete_device.__doc__
+
+    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
+
     def always_executed_hook(self):
         """
         Tango always_executed_hook. Default implementation does

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list