Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 example/examplelibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ def strings_should_be_equal(self, str1, str2):


if __name__ == '__main__':
RobotRemoteServer(ExampleLibrary(), *sys.argv[1:])
RobotRemoteServer([ExampleLibrary()], *sys.argv[1:])
20 changes: 14 additions & 6 deletions 20 src/robotremoteserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def __init__(self, library, host='127.0.0.1', port=8270, port_file=None,
``Stop Remote Server`` keyword and
``stop_remote_server`` XML-RPC method.
"""
self._library = RemoteLibraryFactory(library)
self._library = [RemoteLibraryFactory(library_)
Copy link

@Erich-McMillan Erich-McMillan Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srinivaschavan to maintain backward compatibility could this be a solution?

Suggested change
self._library = [RemoteLibraryFactory(library_)
if isinstance(libraries, list):
self._libraries = [RemoteLibraryFactory(library_)
for library_ in libraries]
else:
self._libraries = [RemoteLibraryFactory(libraries)]

Though not sure if checking isinstance is the most pythonic, maybe checking to see if the item supports __iter__ would be more robust?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this solutions works. Best if you create a new PR with these changes.

for library_ in library]
self._server = StoppableXMLRPCServer(host, int(port))
self._register_functions(self._server)
self._port_file = port_file
Expand Down Expand Up @@ -167,28 +168,35 @@ def stop_remote_server(self, log=True):
return True

def get_keyword_names(self):
return self._library.get_keyword_names() + ['stop_remote_server']
keywords = ['stop_remote_server']
for l in self._library:
keywords += l.get_keyword_names()
return keywords

def run_keyword(self, name, args, kwargs=None):
if name == 'stop_remote_server':
return KeywordRunner(self.stop_remote_server).run_keyword(args, kwargs)
return self._library.run_keyword(name, args, kwargs)
library_ = next(l for l in self._library if name in l._names)
return library_.run_keyword(name, args, kwargs)

def get_keyword_arguments(self, name):
if name == 'stop_remote_server':
return []
return self._library.get_keyword_arguments(name)
library_ = next(l for l in self._library if name in l._names)
return library_.get_keyword_arguments(name)

def get_keyword_documentation(self, name):
if name == 'stop_remote_server':
return ('Stop the remote server unless stopping is disabled.\n\n'
'Return ``True/False`` depending was server stopped or not.')
return self._library.get_keyword_documentation(name)
library_ = next(l for l in self._library if name in l._names)
return library_.get_keyword_documentation(name)

def get_keyword_tags(self, name):
if name == 'stop_remote_server':
return []
return self._library.get_keyword_tags(name)
library_ = next(l for l in self._library if name in l._names)
return library_.get_keyword_tags(name)


class StoppableXMLRPCServer(SimpleXMLRPCServer):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.