Skip to content

Commit

Permalink
arg fix
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed May 4, 2020
1 parent 2411697 commit c573a05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/source/servercode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ The code above could also be written as::

You can perform some limited customization:

.. py:method:: serve(objects [host=None, port=0, daemon=None, ns=True, verbose=True])
.. py:method:: serve(objects [host=None, port=0, daemon=None, use_ns=True, verbose=True])
Very basic method to fire up a daemon that hosts a bunch of objects.
The objects will be registered automatically in the name server if you specify this.
Expand All @@ -266,20 +266,20 @@ You can perform some limited customization:
:param daemon: optional existing daemon to use, that you created yourself.
If you don't specify this, the method will create a new daemon object by itself.
:type daemon: Pyro5.server.Daemon
:param ns: optional, if True (the default), the objects will also be registered in the name server (located using :py:meth:`Pyro5.core.locate_ns`) for you.
:param use_ns: optional, if True (the default), the objects will also be registered in the name server (located using :py:meth:`Pyro5.core.locate_ns`) for you.
If this parameters is False, your objects will only be hosted in the daemon and are not published in a name server.
Read below about the exact behavior of the object names you provide in the ``objects`` dictionary.
:type ns: bool
:param verbose: optional, if True (the default), print out a bit of info on the objects that are registered
:type verbose: bool
:returns: nothing, it starts the daemon request loop and doesn't return until that stops.

If you set ``ns=True`` your objects will appear in the name server as well (this is the default setting).
If you set ``use_ns=True`` (the default) your objects will appear in the name server as well.
Usually this means you provide a logical name for every object in the ``objects`` dictionary.
If you don't (= set it to ``None``), the object will still be available in the daemon (by a generated name) but will *not* be registered
in the name server (this is a bit strange, but hey, maybe you don't want all the objects to be visible in the name server).

When not using a name server at all (``ns=False``), the names you provide are used as the object names
When not using a name server at all (``use_ns=False``), the names you provide are used as the object names
in the daemon itself. If you set the name to ``None`` in this case, your object will get an automatically generated internal name,
otherwise your own name will be used.

Expand Down
4 changes: 2 additions & 2 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ def testSimpleServeLegacy(self):
o1 = MyThingPartlyExposed(1)
o2 = MyThingPartlyExposed(2)
objects = {o1: "test.o1", o2: None}
Pyro5.server.serve(objects, daemon=d, ns=False, verbose=False)
Pyro5.server.serve(objects, daemon=d, use_ns=False, verbose=False)
assert len(d.objectsById) == 3
assert "test.o1" in d.objectsById
assert o1 in d.objectsById.values()
Expand All @@ -1146,7 +1146,7 @@ def testSimpleServeSameNamesLegacy(self):
o3 = MyThingPartlyExposed(3)
objects = {o1: "test.name", o2: "test.name", o3: "test.othername"}
with pytest.raises(Pyro5.errors.DaemonError):
Pyro5.server.serve(objects, daemon=d, ns=False, verbose=False)
Pyro5.server.serve(objects, daemon=d, use_ns=False, verbose=False)

def testSimpleServeSameNames(self):
with TestSimpleServe.DaemonWrapper() as d:
Expand Down

0 comments on commit c573a05

Please sign in to comment.