Revert e52018bfcd. Simply fail. It's documented on the ChangeLog.

This commit is contained in:
Pedro Algarvio 2010-12-10 05:42:19 +00:00
parent 860457ff48
commit 90d23ce582
2 changed files with 2 additions and 27 deletions

View File

@ -53,19 +53,7 @@ class EventManager(component.Component):
if event.name in self.handlers: if event.name in self.handlers:
for handler in self.handlers[event.name]: for handler in self.handlers[event.name]:
#log.debug("Running handler %s for event %s with args: %s", event.name, handler, event.args) #log.debug("Running handler %s for event %s with args: %s", event.name, handler, event.args)
try:
handler(*event.args) handler(*event.args)
except TypeError:
if event.name != "TorrentAddedEvent":
raise
else:
log.warning("TorrentAddedEvent recently got an extra "
"argument, \"from_state\" and the handler "
"\"%s\" is not accepting that extra "
"argument. Correcting for now but this code "
"should be changed.", handler)
handler(event.args[0])
def register_event_handler(self, event, handler): def register_event_handler(self, event, handler):
""" """

View File

@ -167,22 +167,9 @@ class DelugeRPCProtocol(Protocol):
#log.debug("Received RPCEvent: %s", event) #log.debug("Received RPCEvent: %s", event)
# A RPCEvent was received from the daemon so run any handlers # A RPCEvent was received from the daemon so run any handlers
# associated with it. # associated with it.
def call_handler(event, handler, args):
try:
handler(*args)
except TypeError:
if event != "TorrentAddedEvent":
raise
else:
log.warning("TorrentAddedEvent recently got an extra "
"argument, \"from_state\" and the handler "
"\"%s\" is not accepting that extra "
"argument. Correcting for now but this code "
"should be changed.", handler)
handler(args[0])
if event in self.factory.event_handlers: if event in self.factory.event_handlers:
for handler in self.factory.event_handlers[event]: for handler in self.factory.event_handlers[event]:
reactor.callLater(0, call_handler, event, handler, request[2]) reactor.callLater(0, handler, *request[2])
continue continue
request_id = request[1] request_id = request[1]