Module: deluge
Branch: 1.3-stable
Commit: c741e127b925e2d9c2f53b9319ae880bc1a9288b

Author: Asmageddon <asmaged...@gmail.com>
Date:   Sun Jul  1 22:34:09 2012 +0200

First change outside of deluge/ui/console - fixed a problem when removing 
torrents

---

 deluge/ui/sessionproxy.py |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py
index 88a77e9..b1dc29b 100644
--- a/deluge/ui/sessionproxy.py
+++ b/deluge/ui/sessionproxy.py
@@ -102,10 +102,16 @@ class SessionProxy(component.Component):
         """
         sd = {}
         for torrent_id in torrent_ids:
-            if keys:
-                sd[torrent_id] = dict([(x, y) for x, y in 
self.torrents[torrent_id][1].iteritems() if x in keys])
-            else:
-                sd[torrent_id] = dict(self.torrents[torrent_id][1])
+            try:
+                if keys:
+                    sd[torrent_id] = dict([
+                        (x, y) for x, y in 
self.torrents[torrent_id][1].iteritems()
+                        if x in keys
+                    ])
+                else:
+                    sd[torrent_id] = dict(self.torrents[torrent_id][1])
+            except KeyError:
+                continue
 
         return sd
 
@@ -179,10 +185,14 @@ class SessionProxy(component.Component):
             # Update the internal torrent status dict with the update values
             t = time.time()
             for key, value in result.items():
-                self.torrents[key][0] = t
-                self.torrents[key][1].update(value)
-                for k in value:
-                    self.cache_times[key][k] = t
+                try:
+                    self.torrents[key][0] = t
+                    self.torrents[key][1].update(value)
+                    for k in value:
+                        self.cache_times[key][k] = t
+                except KeyError:
+                    #The torrent was removed
+                    continue
 
             # Create the status dict
             if not torrent_ids:

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

Reply via email to