From cb7bab4da02aa46149230dd805e8a7ee7709b231 Mon Sep 17 00:00:00 2001 From: Tomasz Fluxid Kowalczyk Date: Sat, 28 Jan 2012 02:46:59 +0100 Subject: [PATCH] Make name truly optional --- syncplay/server.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/syncplay/server.py b/syncplay/server.py index 543dcc6..a0a133c 100644 --- a/syncplay/server.py +++ b/syncplay/server.py @@ -51,7 +51,11 @@ class SyncProtocol(LineReceiver): )) def _send(self, *args): - self.sendLine(' '.join((arg if isinstance(arg, basestring) else str(arg)) for arg in args)) + self.sendLine(' '.join( + (arg if isinstance(arg, basestring) else str(arg)) + for arg in args + if arg is not None + )) def _drop(self): self.active = False @@ -200,7 +204,10 @@ class SyncFactory(Factory): position = self._find_position() if curtime is None: curtime = time.time() - watcher.watcher_proto.send_state(self.paused, position, (self.pause_change_by and self.pause_change_by.name) or '') + if self.pause_change_by: + watcher.watcher_proto.send_state(self.paused, position, self.pause_change_by.name) + else: + watcher.watcher_proto.send_state(self.paused, position, None) watcher.last_update_sent = curtime def _find_position(self):