[pytango] 13/122: beacon: fixed put_class_property method

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


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

sbodomerle-guest pushed a commit to tag v9.2.1
in repository pytango.

commit ba35a570e8f0604286bd47b333e5f5ca63c8197d
Author: Sébastien Petitdemange <sebastien.petitdemange at esrf.fr>
Date:   Fri Jul 29 18:31:31 2016 +0200

    beacon: fixed put_class_property method
---
 src/boost/python/databaseds/db_access/beacon.py | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/boost/python/databaseds/db_access/beacon.py b/src/boost/python/databaseds/db_access/beacon.py
index 887c31f..b8c0d94 100644
--- a/src/boost/python/databaseds/db_access/beacon.py
+++ b/src/boost/python/databaseds/db_access/beacon.py
@@ -810,17 +810,24 @@ class beacon(object):
     @_info
     def put_class_property(self, class_name, nb_properties, attr_prop_list):
         attr_id = 0
+        class_node = self._class_name_2_node.get(class_name)
+        if class_node is None:
+            class_node = static.Node(self._config,parent=self._config.root,
+                                     filename = 'tango/%s.yml' % class_name.replace('/','_'))
+            class_node['class'] = class_name
+            self._strong_node_ref.add(class_node)
+            self._class_name_2_node[class_name] = class_node
+            
+        properties = class_node.get('properties',dict())
         for k in range(nb_properties):
-            attr_name,nb_properties = attr_prop_list[attr_id],int(attr_prop_list[attr_id + 1])
+            prop_name,nb_values = attr_prop_list[attr_id],int(attr_prop_list[attr_id + 1])
             attr_id += 2
-            class_properties = self._get_class_properties(class_name,prop_name)
-            new_values = {}
-            for prop_id in range(attr_id,attr_id + nb_properties * 2,2) :
-                prop_name,prop_val = attr_prop_list[prop_id],attr_prop_list[prop_id + 1]
-                new_values[prop_name] = prop_val
-            attr_id += nb_properties *2
-            class_properties.set(new_values)
-
+            if nb_values == 1:
+                properties[prop_name] = attr_prop_list[attr_id]
+            else:
+                properties[prop_name] = list(attr_prop_list[attr_id:])
+        class_node['properties'] = properties
+        class_node.save()
     @_info
     def put_device_alias(self, device_name, device_alias):
         device_node = self._tango_name_2_node.get(device_name)

-- 
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