# HG changeset patch # User Edouard Tisserant # Date 1542620390 -3600 # Node ID 2c3222433244c0401b4e3e56ae065eaa73da2474 # Parent 8689ce77076f49b7445ff7e320490f1bbfd703a6 Renaming servicetype into scheme. diff -r 8689ce77076f -r 2c3222433244 connectors/PYRO/__init__.py --- a/connectors/PYRO/__init__.py Fri Nov 16 14:04:51 2018 +0100 +++ b/connectors/PYRO/__init__.py Mon Nov 19 10:39:50 2018 +0100 @@ -51,8 +51,8 @@ """ confnodesroot.logger.write(_("PYRO connecting to URI : %s\n") % uri) - servicetype, location = uri.split("://") - if servicetype == "PYROS": + scheme, location = uri.split("://") + if scheme == "PYROS": import connectors.PYRO.PSK_Adapter schemename = "PYROLOCPSK" url, ID = location.split('#') #TODO fix exception when # not found @@ -124,7 +124,7 @@ confnodesroot.logger.write_error(_("Cannot get PLC ID - connection failed.\n")) return None - if servicetype != "PYROS": + if scheme != "PYROS": ID,PSK = IDPSK secdir = os.path.join(str(confnodesroot.ProjectPath), 'psk') if not os.path.exists(secdir): diff -r 8689ce77076f -r 2c3222433244 connectors/WAMP/__init__.py --- a/connectors/WAMP/__init__.py Fri Nov 16 14:04:51 2018 +0100 +++ b/connectors/WAMP/__init__.py Mon Nov 19 10:39:50 2018 +0100 @@ -69,10 +69,10 @@ WAMP://127.0.0.1:12345/path#realm#ID WAMPS://127.0.0.1:12345/path#realm#ID """ - servicetype, location = uri.split("://") + scheme, location = uri.split("://") urlpath, realm, ID = location.split('#') urlprefix = {"WAMP": "ws", - "WAMPS": "wss"}[servicetype] + "WAMPS": "wss"}[scheme] url = urlprefix+"://"+urlpath def RegisterWampClient(): diff -r 8689ce77076f -r 2c3222433244 connectors/__init__.py --- a/connectors/__init__.py Fri Nov 16 14:04:51 2018 +0100 +++ b/connectors/__init__.py Mon Nov 19 10:39:50 2018 +0100 @@ -64,25 +64,25 @@ Return a connector corresponding to the URI or None if cannot connect to URI """ - servicetype = uri.split("://")[0].upper() - if servicetype == "LOCAL": + scheme = uri.split("://")[0].upper() + if scheme == "LOCAL": # Local is special case # pyro connection to local runtime # started on demand, listening on random port - servicetype = "PYRO" + scheme = "PYRO" runtime_port = confnodesroot.AppFrame.StartLocalRuntime( taskbaricon=True) uri = "PYROLOC://127.0.0.1:" + str(runtime_port) - elif servicetype in connectors: + elif scheme in connectors: pass - elif servicetype[-1] == 'S' and servicetype[:-1] in connectors: - servicetype = servicetype[:-1] + elif scheme[-1] == 'S' and scheme[:-1] in connectors: + scheme = scheme[:-1] else: return None # import module according to uri type - connectorclass = connectors[servicetype]() return connectorclass(uri, confnodesroot) + connectorclass = connectors[scheme]() def EditorClassFromScheme(scheme):