Skip to content

Commit

Permalink
Merge pull request #155 from plone/fix-print-server-url
Browse files Browse the repository at this point in the history
Fix printing the server URL in non-reload mode
  • Loading branch information
davisagli authored Feb 11, 2024
2 parents 209853f + a006356 commit 7e77733
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions news/155.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix printing the server URL when robot-server is run without reloading enabled. @davisagli
17 changes: 11 additions & 6 deletions src/plone/app/robotframework/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,21 @@ def print_urls(zope_layer, xmlrpc_server):
When doing that it is helpful that the URLs with the chosen ports are printed to stdout.
"""

print("Robot XMLRPC: http://{}:{}".format(*xmlrpc_server.server_address))

for layer in zope_layer.baseResolutionOrder:
# Walk up the testing layers and look for the first zserver in order to get the
# actual server name and server port.
zserver = getattr(layer, "zserver", None)
if not zserver:
continue
print(f"ZSERVER: http://{zserver.server_name}:{zserver.server_port}")
break

print("XMLRPC: http://{}:{}".format(*xmlrpc_server.server_address))
if zserver:
print(
f"Zope is running at: http://{zserver.server_name}:{zserver.server_port}/"
)
break
server = getattr(layer, "server", None)
if server:
print(f"Zope is running at: {server.application_url}")
break


def start_reload(
Expand Down

0 comments on commit 7e77733

Please sign in to comment.