Added missing 'path' field to WAMP addresses in URI editor.
authorEdouard Tisserant
Tue, 23 Apr 2019 11:01:35 +0200
changeset 2610 7e31997b2799
parent 2609 c8cb60bf6c6a
child 2611 a1bf03277cec
Added missing 'path' field to WAMP addresses in URI editor.
connectors/WAMP_dialog.py
--- a/connectors/WAMP_dialog.py	Tue Apr 23 11:00:37 2019 +0200
+++ b/connectors/WAMP_dialog.py	Tue Apr 23 11:01:35 2019 +0200
@@ -12,6 +12,7 @@
 Schemes = ["WAMP", "WAMPS"]
 
 model = [('host', _("Host:")),
+         ('path', _("Path:")),
          ('port', _("Port:")),
          ('realm', _("Realm:"))]
 
@@ -24,7 +25,8 @@
 
     # pylint: disable=unused-variable
     def SetLoc(self, loc):
-        hostport, realm, ID = list(islice(chain(loc.split("#"), repeat("")), 3))
+        hostportpath, realm, ID = list(islice(chain(loc.split("#"), repeat("")), 3))
+        hostport, path = list(islice(chain(hostportpath.split("/"), repeat("")), 2))
         host, port = list(islice(chain(hostport.split(":"), repeat("")), 2))
         self.SetFields(locals())
 
@@ -35,6 +37,7 @@
 
         template = "{host}" + \
                    (":{port}" if fields['port'] else '') +\
+                   ("/{path}" if fields['path'] else '') +\
                    "#{realm}#{ID}"
 
         return template.format(**fields)