#2486 Fix if protocol, register options are not present in wapmconf.json file. #2486
authordporopat <denis.poropat@smarteh.si>
Wed, 11 Apr 2018 10:53:48 +0200
branch#2486
changeset 2199 8fd73c6c8aa9
parent 2198 4a5ac299f550
child 2200 6417f5b59eff
#2486 Fix if protocol, register options are not present in wapmconf.json file.
runtime/WampClient.py
--- a/runtime/WampClient.py	Tue Apr 10 12:08:23 2018 +0200
+++ b/runtime/WampClient.py	Wed Apr 11 10:53:48 2018 +0200
@@ -103,13 +103,15 @@
         global _WampSession
         _WampSession = self
         ID = self.config.extra["ID"]
+        validRegisterOptions = {}
 
         registerOptions = self.config.extra.get('registerOptions', None)
-        arguments = inspect.getargspec(types.RegisterOptions.__init__).args
-        validRegisterOptions = getValidOptins(registerOptions, arguments)
-        if validRegisterOptions:
-            registerOptions = types.RegisterOptions(**validRegisterOptions)
-            #print(_("Added custom register options"))
+        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:
             yield self.register(GetCallee(name), u'.'.join((ID, name)), registerOptions)
@@ -140,11 +142,12 @@
         WampWebSocketClientFactory.__init__(self, *args, **kwargs)
 
         protocolOptions = config.extra.get('protocolOptions', None)
-        arguments = inspect.getargspec(self.setProtocolOptions).args
-        validProtocolOptions = getValidOptins(protocolOptions, arguments)
-        if validProtocolOptions:
-            self.setProtocolOptions(**validProtocolOptions)
-            #print(_("Added custom protocol options"))
+        if protocolOptions:
+            arguments = inspect.getargspec(self.setProtocolOptions).args
+            validProtocolOptions = getValidOptins(protocolOptions, arguments)
+            if validProtocolOptions:
+                self.setProtocolOptions(**validProtocolOptions)
+                #print(_("Added custom protocol options"))
 
     def buildProtocol(self, addr):
         self.resetDelay()