From 0eb472e4248690e964ea49ae1b4c73a83d9b44bd Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Thu, 29 Sep 2011 07:51:51 +0300 Subject: [PATCH 18/18] idletest: Use handleCommand instead of dataReceived Unlike dataReceived, handleCommand splits the data if it has multiple messages and parses each message. --- tests/twisted/idletest.py | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/twisted/idletest.py b/tests/twisted/idletest.py index 71e6d8e..5288a37 100644 --- a/tests/twisted/idletest.py +++ b/tests/twisted/idletest.py @@ -134,17 +134,16 @@ class BaseIRCServer(irc.IRC): def sendWelcome(self): self.sendMessage('001', self.nick, ':Welcome to the test IRC Network', prefix='idle.test.server') - def dataReceived(self, data): - (_prefix, _command, _args) = irc.parsemsg(data) - self.event_func(make_irc_event('stream-%s' % _command, _args)) + def handleCommand(self, command, prefix, params): + self.event_func(make_irc_event('stream-%s' % command, params)) try: - f = getattr(self, 'handle%s' % _command) + f = getattr(self, 'handle%s' % command) try: - f(_args, _prefix) + f(params, prefix) except Exception, e: self.log('handler failed: %s' % e) except Exception, e: - self.log('No handler for command %s: %s' % (_command, e)) + self.log('No handler for command %s: %s' % (command, e)) class SSLIRCServer(BaseIRCServer): def __init__(self, event_func): -- 1.7.6.2