diff options
author | MaZderMind <git@mazdermind.de> | 2015-11-15 14:42:47 +0100 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-11-15 14:42:47 +0100 |
commit | d61571d7f81b867625ad0dfc62c410ba5bad06af (patch) | |
tree | 3fe659a1a841a55ff03a7d3e2a9886e63ab72380 /voctocore | |
parent | 478b2e0e4510796b8f4a1e145e8e5c415b24e8b2 (diff) |
Allow a Command to return multiple notifications
Diffstat (limited to 'voctocore')
-rw-r--r-- | voctocore/lib/controlserver.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/voctocore/lib/controlserver.py b/voctocore/lib/controlserver.py index 48fff65..90d4e7c 100644 --- a/voctocore/lib/controlserver.py +++ b/voctocore/lib/controlserver.py @@ -87,6 +87,7 @@ class ControlServer(TCPMultiConnection): self.log.info("processing command %r with args %s", command, args) + response = None try: command_function = self.commands.__class__.__dict__[command] @@ -104,17 +105,19 @@ class ControlServer(TCPMultiConnection): else: if isinstance(responseObject, NotifyResponse): - signal = "%s\n" % str(responseObject) - for conn, queue in self.currentConnections.items(): - if conn == requestor: - continue + responseObject = [ responseObject ] - queue.put(signal) + if isinstance(responseObject, list): + for obj in responseObject: + signal = "%s\n" % str(obj) + for conn, queue in self.currentConnections.items(): + queue.put(signal) - response = "%s\n" % str(responseObject) + else: + response = "%s\n" % str(responseObject) finally: - if requestor in self.currentConnections: + if response is not None and requestor in self.currentConnections: self.currentConnections[requestor].put(response) return True |