summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbendikro <bendikro@gmail.com>2013-02-15 11:38:14 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2013-05-03 18:00:37 +0100
commite6498b6864552e4d070c14bdacf16f74b9be68c0 (patch)
treeafa55470cfa4ef41ee6e8135df9f12b58a7bf7f2
parent4b310610371bfb9139ffcfa33372801d4d3bcd4c (diff)
downloaddeluge-e6498b68.tar.gz
deluge-e6498b68.tar.bz2
deluge-e6498b68.zip
Fix #2277 : Plugins keys weren't fetched in filter_torrent_ids
Fixed bug introduced in 8c106ce8c4c0794ddd63e8e8f98b097221a56a52 where keys for plugins weren't fetched in filter_torrent_ids.
-rw-r--r--deluge/core/core.py6
-rw-r--r--deluge/core/filtermanager.py5
-rw-r--r--deluge/core/torrent.py4
-rw-r--r--deluge/core/torrentmanager.py2
4 files changed, 9 insertions, 8 deletions
diff --git a/deluge/core/core.py b/deluge/core/core.py
index ef7366747..f67c40ddf 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -420,9 +420,9 @@ class Core(component.Component):
for torrent_id in torrent_ids:
self.torrentmanager[torrent_id].resume()
- def create_torrent_status(self, torrent_id, torrent_keys, plugin_keys, diff=False, update=False):
+ def create_torrent_status(self, torrent_id, torrent_keys, plugin_keys, diff=False, update=False, all_keys=False):
try:
- status = self.torrentmanager[torrent_id].get_status(torrent_keys, diff, update=update)
+ status = self.torrentmanager[torrent_id].get_status(torrent_keys, diff, update=update, all_keys=all_keys)
except KeyError:
import traceback
traceback.print_exc()
@@ -437,7 +437,7 @@ class Core(component.Component):
@export
def get_torrent_status(self, torrent_id, keys, diff=False):
torrent_keys, plugin_keys = self.torrentmanager.separate_keys(keys, [torrent_id])
- return self.create_torrent_status(torrent_id, torrent_keys, plugin_keys, diff=diff, update=True)
+ return self.create_torrent_status(torrent_id, torrent_keys, plugin_keys, diff=diff, update=True, all_keys=not keys)
@export
def get_torrents_status(self, filter_dict, keys, diff=False):
diff --git a/deluge/core/filtermanager.py b/deluge/core/filtermanager.py
index c9545072c..cf5d235ba 100644
--- a/deluge/core/filtermanager.py
+++ b/deluge/core/filtermanager.py
@@ -155,7 +155,7 @@ class FilterManager(component.Component):
if isinstance(value, basestring):
filter_dict[key] = [value]
- if "id"in filter_dict: #optimized filter for id:
+ if "id" in filter_dict: #optimized filter for id:
torrent_ids = list(filter_dict["id"])
del filter_dict["id"]
else:
@@ -189,10 +189,11 @@ class FilterManager(component.Component):
if not filter_dict: #return if there's nothing more to filter
return torrent_ids
+ torrent_keys, plugin_keys = self.torrents.separate_keys(filter_dict.keys(), torrent_ids)
#leftover filter arguments:
#default filter on status fields.
for torrent_id in list(torrent_ids):
- status = self.torrents[torrent_id].get_status(filter_dict.keys()) #status={key:value}
+ status = self.core.create_torrent_status(torrent_id, torrent_keys, plugin_keys)
for field, values in filter_dict.iteritems():
if (not status[field] in values) and torrent_id in torrent_ids:
torrent_ids.remove(torrent_id)
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 99ba11a0d..bf833f0bf 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -626,7 +626,7 @@ class Torrent(object):
return host
return ""
- def get_status(self, keys, diff=False, update=False):
+ def get_status(self, keys, diff=False, update=False, all_keys=False):
"""
Returns the status of the torrent based on the keys provided
@@ -646,7 +646,7 @@ class Torrent(object):
if update:
self.update_status(self.handle.status())
- if not keys:
+ if all_keys:
keys = self.status_funcs.keys()
status_dict = {}
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 1a458d785..486565d76 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -1151,7 +1151,7 @@ class TorrentManager(component.Component):
# Could be the clients cache (sessionproxy) isn't up to speed.
del status_dict[torrent_id]
else:
- status_dict[torrent_id] = self.torrents[torrent_id].get_status(torrent_keys, diff)
+ status_dict[torrent_id] = self.torrents[torrent_id].get_status(torrent_keys, diff, all_keys=not keys)
self.status_dict = status_dict
d.callback((status_dict, plugin_keys))