[Core] Return all plugin status keys with empty list

This commit is contained in:
Calum Lind 2015-09-27 00:29:25 +01:00
parent 542e028977
commit eab7850ed6
2 changed files with 4 additions and 2 deletions

View File

@ -434,9 +434,9 @@ class Core(component.Component):
# Torrent was probaly removed meanwhile # Torrent was probaly removed meanwhile
return {} return {}
# Get the leftover fields and ask the plugin manager to fill them # Get any remaining keys from plugin manager or 'all' if no keys specified.
leftover_fields = list(set(keys) - set(status.keys())) leftover_fields = list(set(keys) - set(status.keys()))
if len(leftover_fields) > 0: if len(leftover_fields) > 0 or len(keys) == 0:
status.update(self.pluginmanager.get_status(torrent_id, leftover_fields)) status.update(self.pluginmanager.get_status(torrent_id, leftover_fields))
return status return status

View File

@ -92,6 +92,8 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase,
def get_status(self, torrent_id, fields): def get_status(self, torrent_id, fields):
"""Return the value of status fields for the selected torrent_id.""" """Return the value of status fields for the selected torrent_id."""
status = {} status = {}
if len(fields) == 0:
fields = self.status_fields.keys()
for field in fields: for field in fields:
try: try:
status[field] = self.status_fields[field](torrent_id) status[field] = self.status_fields[field](torrent_id)