From 1b0e08b3d9ea5ccda07eccc5b080a7103be10d16 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Sun, 2 May 2010 18:06:08 +0100 Subject: [PATCH] fix disabling the execute plugin --- deluge/plugins/execute/execute/core.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deluge/plugins/execute/execute/core.py b/deluge/plugins/execute/execute/core.py index ca584df21..457f44240 100644 --- a/deluge/plugins/execute/execute/core.py +++ b/deluge/plugins/execute/execute/core.py @@ -76,18 +76,18 @@ class Core(CorePluginBase): def enable(self): self.config = ConfigManager("execute.conf", DEFAULT_CONFIG) event_manager = component.get("EventManager") - registered_events = [] + self.registered_events = {} # Go through the commands list and register event handlers for command in self.config["commands"]: event = command[EXECUTE_EVENT] - if event in registered_events: + if event in self.registered_events: continue def event_handler(torrent_id): self.execute_commands(torrent_id, command[EXECUTE_EVENT]) event_manager.register_event_handler(EVENT_MAP[event], event_handler) - registered_events.append(event) + self.registered_events[event] = event_handler log.debug("Execute core plugin enabled!") @@ -114,9 +114,9 @@ class Core(CorePluginBase): def disable(self): self.config.save() event_manager = component.get("EventManager") - event_manager.deregister_event_handler("TorrentFinishedEvent", - self.on_torrent_finished) - log.debug("Example core plugin disabled!") + for event, handler in self.registered_events.iteritems(): + event_manager.deregister_event_handler(event, handler) + log.debug("Execute core plugin disabled!") ### Exported RPC methods ### @export