diff options
author | Damien Churchill <damoxc@gmail.com> | 2011-06-12 23:48:52 +0100 |
---|---|---|
committer | Damien Churchill <damoxc@gmail.com> | 2011-10-05 01:31:13 +0100 |
commit | 8b69d66baea1fff6129c6bc31cb778ca236c6be3 (patch) | |
tree | 5e85d6398ce6069baf5ab41613f0f0690f9c2c98 | |
parent | 3ee434975c2bebb0e37b987feeb40ff064983f60 (diff) | |
download | deluge-8b69d66baea1fff6129c6bc31cb778ca236c6be3.tar.gz deluge-8b69d66baea1fff6129c6bc31cb778ca236c6be3.tar.bz2 deluge-8b69d66baea1fff6129c6bc31cb778ca236c6be3.zip |
tidy up some deferred stuff
-rw-r--r-- | deluge/ui/web/json_api.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 2cf90b70d..13d60b449 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -567,7 +567,7 @@ class WebApi(JSONComponent): dl.addCallback(on_complete) return d - def _on_got_files(self, torrent, d): + def _on_got_files(self, torrent): files = torrent.get("files") file_progress = torrent.get("file_progress") file_priorities = torrent.get("file_priorities") @@ -610,7 +610,7 @@ class WebApi(JSONComponent): file_tree = uicommon.FileTree2(paths) file_tree.walk(walk) - d.callback(file_tree.get_tree()) + return file_tree.get_tree() @export def get_torrent_status(self, torrent_id, keys): @@ -626,10 +626,8 @@ class WebApi(JSONComponent): :returns: The torrents files in a tree :rtype: dictionary """ - main_deferred = Deferred() - d = component.get("SessionProxy").get_torrent_status(torrent_id, FILES_KEYS) - d.addCallback(self._on_got_files, main_deferred) - return main_deferred + return component.get("SessionProxy").get_torrent_status(torrent_id, FILES_KEYS + ).addCallback(self._on_got_files) @export def download_torrent_from_url(self, url, cookie=None): |