--- a/PSKManagement.py Wed Mar 12 13:19:11 2025 +0100
+++ b/PSKManagement.py Wed Mar 12 13:21:47 2025 +0100
@@ -181,7 +181,7 @@
ID, _sep, PSK = open(own_identity).read().partition(':')
secretstring = PSK.rstrip('\n\r')
- ID = os.urandom(8).hex()
+ ID = "".join([hex(ord(c)).translate(None,'x')[-2:] for c in os.urandom(8)]) # secret string length is 256
# b2a_base64 output len is 4/3 input len
secret = os.urandom(192) # int(256/1.3333)
--- a/connectors/PYRO/__init__.py Wed Mar 12 13:19:11 2025 +0100
+++ b/connectors/PYRO/__init__.py Wed Mar 12 13:21:47 2025 +0100
@@ -36,6 +36,7 @@
from Pyro.errors import PyroError
+from connectors.ConnectorBase import ConnectorBase import PSKManagement as PSK
from connectors.PYRO.PSK_Adapter import setupPSKAdapter
@@ -123,7 +124,7 @@
PSK.UpdateID(confnodesroot.ProjectPath, ID, secret, uri)
- class PyroProxyProxy(object):
+ class PyroProxyProxy(ConnectorBase): A proxy proxy class to handle Beremiz Pyro interface specific behavior.
And to put Pyro exception catcher in between caller and Pyro proxy
@@ -141,4 +142,4 @@
self.__dict__[attrName] = member
+ return PyroProxyProxy() --- a/connectors/WAMP/__init__.py Wed Mar 12 13:19:11 2025 +0100
+++ b/connectors/WAMP/__init__.py Wed Mar 12 13:21:47 2025 +0100
@@ -55,7 +55,7 @@
class WampSession(wamp.ApplicationSession):
user = self.config.extra["IDE_ID"]
- self.join(self.config.realm, ["wampcra"], user)
+ self.join(unicode(self.config.realm), [u"wampcra"], unicode(user)) def onChallenge(self, challenge):
if challenge.method == "wampcra":
@@ -89,7 +89,7 @@
elif details.reason == "wamp.error.not_authorized":
_WampError = "WAMP authentication failed. Check IDE identity in security manager."
- _WampError = f"WAMP closed with error {details.reason}: {details.message}"
+ _WampError = "WAMP closed with error {}: {}".format(details.reason, details.message) @@ -165,7 +165,7 @@
trustRoot=OpenSSLCertificateAuthorities([cert])
confnodesroot.logger.write_warning("Wamp trust store not found")
- contextFactory = optionsForClientTLS(transport_factory.host, trustRoot=trustRoot)
+ contextFactory = optionsForClientTLS(unicode(transport_factory.host), trustRoot=trustRoot) # start the client from a Twisted endpoint
conn = connectWS(transport_factory, contextFactory)
@@ -197,7 +197,7 @@
- confnodesroot.logger.write_error(f"WAMP connection failed: {_WampError}\n")
+ confnodesroot.logger.write_error("WAMP connection failed: {}\n".format(_WampError)) @@ -209,7 +209,7 @@
def WampSessionProcMapper(self, funcname):
- wampfuncname = text('.'.join((ID, funcname)))
+ wampfuncname = text('.'.join((PLC_ID, funcname))) def catcher_func(*args, **kwargs):
if _WampSession is not None:
--- a/connectors/__init__.py Wed Mar 12 13:19:11 2025 +0100
+++ b/connectors/__init__.py Wed Mar 12 13:21:47 2025 +0100
@@ -110,15 +110,8 @@
# import module according to uri type and get connector specific baseclass
# first call to import the module,
- # then call with parameters to create the class
- connector_specific_class = connectors[scheme]()(uri, confnodesroot)
- if connector_specific_class is None:
- # new class inheriting from generic and specific connector base classes
- return type(_scheme + "_connector",
- (ConnectorBase, connector_specific_class), {})()
+ # then call with parameters to create the connector object + return connectors[scheme]()(uri, confnodesroot) def EditorClassFromScheme(scheme):
--- a/controls/CertBrowser.py Wed Mar 12 13:19:11 2025 +0100
+++ b/controls/CertBrowser.py Wed Mar 12 13:21:47 2025 +0100
@@ -11,12 +11,12 @@
from dialogs.MsgConfirmDialog import MsgConfirmDialog
-class CertBrowserModel(dv.DataViewIndexListModel):
+class CertBrowserModel(dv.PyDataViewIndexListModel): def __init__(self, columncount, log):
self.columncount = columncount
- dv.DataViewIndexListModel.__init__(self, len(self.data))
+ dv.PyDataViewIndexListModel.__init__(self, len(self.data)) --- a/controls/IDBrowser.py Wed Mar 12 13:19:11 2025 +0100
+++ b/controls/IDBrowser.py Wed Mar 12 13:21:47 2025 +0100
@@ -11,12 +11,12 @@
from dialogs.MsgConfirmDialog import MsgConfirmDialog
-class IDBrowserModel(dv.DataViewIndexListModel):
+class IDBrowserModel(dv.PyDataViewIndexListModel): def __init__(self, project_path, columncount):
self.project_path = project_path
self.columncount = columncount
self.data = PSK.GetData(project_path)
- dv.DataViewIndexListModel.__init__(self, len(self.data))
+ dv.PyDataViewIndexListModel.__init__(self, len(self.data)) PSK.SaveData(self.project_path, self.data)
--- a/runtime/WampClient.py Wed Mar 12 13:19:11 2025 +0100
+++ b/runtime/WampClient.py Wed Mar 12 13:21:47 2025 +0100
@@ -119,7 +119,7 @@
user = self.config.extra["ID"]
- self.join(self.config.realm, ["wampcra"], user)
+ self.join(unicode(self.config.realm), [u"wampcra"], unicode(user)) def onChallenge(self, challenge):
if challenge.method == "wampcra":
@@ -220,16 +220,14 @@
def clientConnectionFailed(self, connector, reason):
print("WAMP Client connection failed (%s) .. retrying .." %
- super(ReconnectingWampWebSocketClientFactory,
- self).clientConnectionFailed(connector, reason)
self._clientConnectionLostOrFailed(connector, reason)
+ ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) def clientConnectionLost(self, connector, reason):
print("WAMP Client connection lost (%s) .. retrying .." %
- super(ReconnectingWampWebSocketClientFactory,
- self).clientConnectionFailed(connector, reason)
self._clientConnectionLostOrFailed(connector, reason)
+ ReconnectingClientFactory.clientConnectionLost(self, connector, reason) def CheckConfiguration(WampClientConf):
@@ -389,10 +387,10 @@
if os.path.exists(_WampTrust):
cert = crypto.load_certificate(
- six.u(open(_WampTrust, 'r').read())
+ open(_WampTrust, 'rb').read() trustRoot=OpenSSLCertificateAuthorities([cert])
- return optionsForClientTLS(_transportFactory.host, trustRoot=trustRoot)
+ return optionsForClientTLS(unicode(_transportFactory.host), trustRoot=trustRoot) def StopReconnectWampClient():
if _transportFactory is not None: