Skip to content

Commit 0b01f41

Browse files
committed
Pyro URI now accepts spaces in the location part (for unix sockets)
1 parent 02fadee commit 0b01f41

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Pyro5/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class URI(object):
4141
You can write the protocol in lowercase if you like (``pyro:...``) but it will
4242
automatically be converted to uppercase internally.
4343
"""
44-
uriRegEx = re.compile(r"(?P<protocol>[Pp][Yy][Rr][Oo][a-zA-Z]*):(?P<object>\S+?)(@(?P<location>\S+))?$")
44+
uriRegEx = re.compile(r"(?P<protocol>[Pp][Yy][Rr][Oo][a-zA-Z]*):(?P<object>\S+?)(@(?P<location>.+))?$")
4545

4646
def __init__(self, uri):
4747
if isinstance(uri, URI):

tests/test_core.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ def test_uri(self):
1414
assert u1 == u2
1515
assert u1 is not u2
1616

17+
def test_unix_uri(self):
18+
p = Pyro5.core.URI("PYRO:12345@./u:/tmp/sockname")
19+
assert p.object == "12345"
20+
assert p.sockname == "/tmp/sockname"
21+
p = Pyro5.core.URI("PYRO:12345@./u:../sockname")
22+
assert p.object == "12345"
23+
assert p.sockname == "../sockname"
24+
p = Pyro5.core.URI("PYRO:12345@./u:/path with spaces/sockname ")
25+
assert p.object == "12345"
26+
assert p.sockname == "/path with spaces/sockname "

0 commit comments

Comments
 (0)