runtime/WampClient.py
branch#2486
changeset 2206 1e397afc36a9
parent 2205 4c74218b42e1
child 2207 c27b820cb96b
--- a/runtime/WampClient.py	Mon May 14 13:05:54 2018 +0200
+++ b/runtime/WampClient.py	Fri May 18 11:05:49 2018 +0200
@@ -44,21 +44,19 @@
 _WampSecret = None
 
 ExposedCalls = [
-    "StartPLC",
-    "StopPLC",
-    "ForceReload",
-    "GetPLCstatus",
-    "NewPLC",
-    "MatchMD5",
-    "SetTraceVariablesList",
-    "GetTraceVariables",
-    "RemoteExec",
-    "GetLogMessage",
-    "ResetLogCount",
+    ("StartPLC", {}),
+    ("StopPLC", {}),
+    ("ForceReload", {}),
+    ("GetPLCstatus", {}),
+    ("NewPLC", {}),
+    ("MatchMD5", {}),
+    ("SetTraceVariablesList", {}),
+    ("GetTraceVariables", {}),
+    ("RemoteExec", {}),
+    ("GetLogMessage", {}),
+    ("ResetLogCount", {})
 ]
 
-ExposedProgressCalls = []
-
 # Those two lists are meant to be filled by customized runtime
 # or User python code.
 
@@ -108,26 +106,16 @@
         global _WampSession
         _WampSession = self
         ID = self.config.extra["ID"]
-        validRegisterOptions = {}
-
-        registerOptions = self.config.extra.get('registerOptions', None)
-        if registerOptions:
-            arguments = inspect.getargspec(types.RegisterOptions.__init__).args
-            validRegisterOptions = getValidOptins(registerOptions, arguments)
-            if validRegisterOptions:
-                registerOptions = types.RegisterOptions(**validRegisterOptions)
-                #print(_("Added custom register options"))
-
-        for name in ExposedCalls:
+
+        for name, kwargs in ExposedCalls:
+            try:
+                registerOptions = types.RegisterOptions(**kwargs)
+            except TypeError as e:
+                registerOptions = None
+                print(_("TypeError register option: {}".format(e)))
+
             yield self.register(GetCallee(name), u'.'.join((ID, name)), registerOptions)
 
-        if ExposedProgressCalls:
-            validRegisterOptions["details_arg"] = 'details'
-            registerOptions = types.RegisterOptions(**validRegisterOptions)
-            # using progress, details argument must be added
-            for name in ExposedProgressCalls:
-                yield self.register(GetCallee(name), u'.'.join((ID, name)), registerOptions)
-
         for name in SubscribedEvents:
             yield self.subscribe(GetCallee(name), unicode(name))