More versatile registering of wamp callees
authorEdouard Tisserant
Tue, 10 Feb 2015 00:25:17 +0100
changeset 1445 e25479e3fe11
parent 1444 c162f1b0fbac
child 1446 4963e3816641
More versatile registering of wamp callees
runtime/WampClient.py
--- a/runtime/WampClient.py	Mon Feb 09 13:38:00 2015 +0100
+++ b/runtime/WampClient.py	Tue Feb 10 00:25:17 2015 +0100
@@ -27,12 +27,12 @@
                 "ResetLogCount",
                 ]
 
-def MakeCallee(name):
+def GetCallee(name):
     global _PySrv
-    def Callee(*args,**kwargs):
-        return getattr(_PySrv.plcobj, name)(*args,**kwargs)
-    return Callee
-
+    names = name.split('.')
+    obj = _PySrv.plcobj
+    while names: obj = getattr(obj, names.pop(0))
+    return obj
 
 class WampSession(wamp.ApplicationSession):
 
@@ -43,7 +43,7 @@
         ID = self.config.extra["ID"]
         print 'WAMP session joined by :', ID
         for name in ExposedCalls:
-            reg = yield self.register(MakeCallee(name), '.'.join((ID,name)))
+            reg = yield self.register(GetCallee(name), '.'.join((ID,name)))
 
     def onLeave(self, details):
         global _WampSession