# HG changeset patch # User dporopat # Date 1526634349 -7200 # Node ID 1e397afc36a95d8d472386c342c9d58466d75890 # Parent 4c74218b42e1eab9ff6c6103241d0ee8afe7e909 #2486 ExposedCalls with register options as a dictionary. diff -r 4c74218b42e1 -r 1e397afc36a9 runtime/WampClient.py --- 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)) diff -r 4c74218b42e1 -r 1e397afc36a9 tests/wamp/project_files/wampconf.json --- a/tests/wamp/project_files/wampconf.json Mon May 14 13:05:54 2018 +0200 +++ b/tests/wamp/project_files/wampconf.json Fri May 18 11:05:49 2018 +0200 @@ -8,10 +8,5 @@ "autoPingTimeout": 20 }, "realm": "Automation", - "registerOptions": { - "concurrency": 2, - "invoke": "last", - "match": "exact" - }, "url": "ws://127.0.0.1:8888" }