Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
URIs now allow spaces in location part. Fixes #222
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Oct 1, 2019
1 parent 1315564 commit 5f9ad60
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Change Log

- dropped support for Python 3.4 (which has reached end-of-life status). Supported Python versions are now 2.7, and 3.5 or newer.
(the life cycle status of the Python versions can be seen here https://devguide.python.org/#status-of-python-branches)
- URIs now allow spaces in the location part. Useful for unix domain sockets.


**Pyro 4.76**
Expand Down
1 change: 1 addition & 0 deletions examples/timezones/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def test():

# pickle.
print("\n******* pickle *******")
print("******* (expecting no errors) ******")
Pyro4.config.SERIALIZER = "pickle"
try:
test()
Expand Down
2 changes: 1 addition & 1 deletion src/Pyro4/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class URI(object):
You can write the protocol in lowercase if you like (``pyro:...``) but it will
automatically be converted to uppercase internally.
"""
uriRegEx = re.compile(r"(?P<protocol>[Pp][Yy][Rr][Oo][a-zA-Z]*):(?P<object>\S+?)(@(?P<location>\S+))?$")
uriRegEx = re.compile(r"(?P<protocol>[Pp][Yy][Rr][Oo][a-zA-Z]*):(?P<object>\S+?)(@(?P<location>.+))?$")

def __init__(self, uri):
if isinstance(uri, URI):
Expand Down
6 changes: 6 additions & 0 deletions tests/PyroTests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def testUriStrAndRepr(self):
self.assertEqual(uri, str(p))
self.assertEqual(unicodeuri, unicode(p))
self.assertTrue(type(p.sockname) is unicode)
uri = "PYRO:12345@./u:sock name with strings"
p = Pyro4.core.URI(uri)
self.assertEqual(uri, str(p))

def testUriParsingPyro(self):
p = Pyro4.core.URI("PYRONAME:some_obj_name")
Expand Down Expand Up @@ -159,6 +162,9 @@ def testUriParsingPyro(self):
p = Pyro4.core.URI("PYRO:12345@./u:/tmp/sockname")
self.assertEqual("12345", p.object)
self.assertEqual("/tmp/sockname", p.sockname)
p = Pyro4.core.URI("PYRO:12345@./u:/path with spaces/sockname ")
self.assertEqual("12345", p.object)
self.assertEqual("/path with spaces/sockname ", p.sockname)
p = Pyro4.core.URI("PYRO:12345@./u:../sockname")
self.assertEqual("12345", p.object)
self.assertEqual("../sockname", p.sockname)
Expand Down

0 comments on commit 5f9ad60

Please sign in to comment.