Fix previous fix for non-present key in cache.

This commit is contained in:
Andrew Resch 2007-12-28 13:39:47 +00:00
parent e069542e3a
commit 24471624c2
1 changed files with 5 additions and 1 deletions

View File

@ -299,14 +299,18 @@ class TorrentView(listview.ListView, component.Component):
# This is to prevent updating stuff we don't need to and should save # This is to prevent updating stuff we don't need to and should save
# GTK from redrawing needlessly. # GTK from redrawing needlessly.
new_status = {} new_status = {}
for torrent_id in status.keys(): for torrent_id in status.keys():
if torrent_id in self.previous_batched_status.keys(): if torrent_id in self.previous_batched_status.keys():
old = self.previous_batched_status[torrent_id] old = self.previous_batched_status[torrent_id]
new = status[torrent_id] new = status[torrent_id]
diff = {} diff = {}
for key in new.keys(): for key in new.keys():
if not key in old.keys(): if not key in old.keys():
diff[key] = new[key]
continue continue
# There is a difference, so lets add it to our new dict # There is a difference, so lets add it to our new dict
if new[key] != old[key]: if new[key] != old[key]:
diff[key] = new[key] diff[key] = new[key]
@ -317,7 +321,7 @@ class TorrentView(listview.ListView, component.Component):
new_status[torrent_id] = status[torrent_id] new_status[torrent_id] = status[torrent_id]
self.previous_batched_status = status self.previous_batched_status = status
row = self.liststore.get_iter_first() row = self.liststore.get_iter_first()
while row != None: while row != None:
torrent_id = self.liststore.get_value( torrent_id = self.liststore.get_value(