refactoring

This commit is contained in:
Uriziel 2012-07-10 18:19:42 +02:00
parent f8672bdd6d
commit 97a357ae00
2 changed files with 5 additions and 5 deletions

View File

@ -58,7 +58,7 @@ class SyncClientProtocol(CommandProtocol):
def handle_connected_state(self, args):
args = self.__parseState(args)
if not args:
self.drop_with_error('Malformed state attributes')
self.dropWithError('Malformed state attributes')
return
counter, ctime, paused, position, name = args
@ -72,7 +72,7 @@ class SyncClientProtocol(CommandProtocol):
ctime = int(ctime)
position = int(position)
except ValueError:
self.drop_with_error('Invalid arguments')
self.dropWithError('Invalid arguments')
ctime /= 1000.0
position /= 1000.0

View File

@ -42,7 +42,7 @@ class CommandProtocol(LineReceiver):
args = ArgumentParser.splitArguments(line)
if not args:
self.drop_with_error('Malformed line')
self.dropWithError('Malformed line')
return
command = args.pop(0)
#if command not in ['ping', 'pong']:
@ -56,7 +56,7 @@ class CommandProtocol(LineReceiver):
if handler:
handler = getattr(self, handler, None)
if not handler:
self.drop_with_error('Unknown command: `%s`' % command)
self.dropWithError('Unknown command: `%s`' % command)
return # TODO log it too
handler(args)
@ -77,7 +77,7 @@ class CommandProtocol(LineReceiver):
def drop(self):
self.transport.loseConnection()
def drop_with_error(self, error):
def dropWithError(self, error):
self.send_message('error', error)
self.drop()