[pytango] 423/483: Add member filter to Server.register_object

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:15:08 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 5d11d7da8f336821820dd69a55f829d98a8e846a
Author: coutinho <coutinho at esrf.fr>
Date:   Sat Dec 13 17:19:36 2014 +0100

    Add member filter to Server.register_object
---
 src/boost/python/server.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/boost/python/server.py b/src/boost/python/server.py
index 07b6b94..fdc07b6 100644
--- a/src/boost/python/server.py
+++ b/src/boost/python/server.py
@@ -1162,7 +1162,7 @@ def __to_tango_type_fmt(value):
     return dtype, dfmt, max_dim_x, max_dim_y
 
 
-def create_tango_class(obj, tango_class_name=None):
+def create_tango_class(obj, tango_class_name=None, member_filter=None):
 
     obj_klass = obj.__class__
     obj_klass_name = obj_klass.__name__
@@ -1199,7 +1199,8 @@ def create_tango_class(obj, tango_class_name=None):
             logging.debug("Details:", exc_info=1)
         if inspect.isclass(member) or inspect.ismodule(member):
             continue
-
+        if member_filter and not member_filter(member):
+            continue
         if inspect.isroutine(member):
             func = member
             func_name = name
@@ -1423,7 +1424,8 @@ class _Server:
                                "while server is running")
         self.__tango_classes.append(klass)
 
-    def register_object(self, obj, name, tango_class_name=None):
+    def register_object(self, obj, name, tango_class_name=None,
+                        member_filter=None):
         slash_count = name.count("/")
         if slash_count == 0:
             alias = name
@@ -1438,7 +1440,8 @@ class _Server:
         tango_class_name = tango_object.tango_class_name
         tango_class = self.get_tango_class(tango_class_name)
         if tango_class is None:
-            tango_class = create_tango_class(obj, tango_class_name)
+            tango_class = create_tango_class(obj, tango_class_name,
+                                             member_filter=member_filter)
             self.register_tango_class(tango_class)
         self.__objects[full_name.lower()] = tango_object
         return tango_object

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