OPC-UA: tolerate better pre-encryption formated client configuration file. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Fri, 18 Nov 2022 07:34:29 +0100
branchwxPython4
changeset 3678 6c496a8ed2a9
parent 3677 6d9040e07c32
child 3679 b6bca75bf3fa
OPC-UA: tolerate better pre-encryption formated client configuration file.
opc_ua/client.py
tests/projects/opcua_client/opcua_0@opcua/confnode.xml
--- a/opc_ua/client.py	Tue Nov 15 20:43:39 2022 +0100
+++ b/opc_ua/client.py	Fri Nov 18 07:34:29 2022 +0100
@@ -101,7 +101,13 @@
         return self.modeldata
 
     def GetConfig(self):
-        cfg = lambda path: self.GetParamsAttributes("OPCUAClient."+path)["value"]
+        def cfg(path): 
+            try:
+                attr=self.GetParamsAttributes("OPCUAClient."+path)
+            except ValueError:
+                return None
+            return attr["value"]
+
         AuthType = cfg("AuthType")
         res = dict(URI=cfg("Server_URI"), AuthType=AuthType)
 
--- a/tests/projects/opcua_client/opcua_0@opcua/confnode.xml	Tue Nov 15 20:43:39 2022 +0100
+++ b/tests/projects/opcua_client/opcua_0@opcua/confnode.xml	Fri Nov 18 07:34:29 2022 +0100
@@ -1,4 +1,2 @@
 <?xml version='1.0' encoding='utf-8'?>
-<OPCUAClient xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-  <AuthType/>
-</OPCUAClient>
+<OPCUAClient xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>