Module: deluge
Branch: master
Commit: f6195f775fd59f7731d83864990f4121ec4072f5

Author: John Garland <[email protected]>
Date:   Tue Jun  8 00:17:22 2010 +1000

Fix execute plugin only executing last event (#1306)

---

 deluge/plugins/execute/execute/core.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/deluge/plugins/execute/execute/core.py 
b/deluge/plugins/execute/execute/core.py
index 57fd13f..4c5e660 100644
--- a/deluge/plugins/execute/execute/core.py
+++ b/deluge/plugins/execute/execute/core.py
@@ -84,8 +84,11 @@ class Core(CorePluginBase):
             if event in self.registered_events:
                 continue
 
-            def event_handler(torrent_id):
-                self.execute_commands(torrent_id, command[EXECUTE_EVENT])
+            def create_event_handler(event):
+                def event_handler(torrent_id):
+                    self.execute_commands(torrent_id, event)
+                return event_handler
+            event_handler = create_event_handler(event)
             event_manager.register_event_handler(EVENT_MAP[event], 
event_handler)
             self.registered_events[event] = event_handler
 
@@ -102,7 +105,7 @@ class Core(CorePluginBase):
         else:
             save_path = info["save_path"]
 
-        log.debug("[execute] Running commands for %s", EXECUTE_EVENT)
+        log.debug("[execute] Running commands for %s", event)
 
         # Go through and execute all the commands
         for command in self.config["commands"]:

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to