From fa20e49a934ed7202513a314b415499f0e8ac768 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 26 Apr 2011 08:37:20 +0100 Subject: [PATCH] Fixed 2 bugs regarding torrent ownership change. On the core, the code was not adapted to the new AuthManager. On The GtkUI, nothing was being shown to the user when errors occurred while changing ownership. --- deluge/core/core.py | 2 +- deluge/ui/gtkui/menubar.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 6586fff05..e04fe25e5 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -603,7 +603,7 @@ class Core(component.Component): :raises DelugeError: if the username is not known """ - if username not in self.authmanager.get_known_accounts(): + if not self.authmanager.has_account(username): raise DelugeError("Username \"%s\" is not known." % username) if isinstance(torrent_ids, basestring): torrent_ids = [torrent_ids] diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index 6026f1387..f73f9cc02 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -47,6 +47,7 @@ import deluge.component as component from deluge.ui.client import client import deluge.common import common +import dialogs from deluge.configmanager import ConfigManager log = logging.getLogger(__name__) @@ -554,7 +555,16 @@ class MenuBar(component.Component): torrent_status = component.get("TorrentView").get_torrent_status(torrent_id) if torrent_status["owner"] != username: update_torrents.append(torrent_id) + if update_torrents: log.debug("Setting torrent owner \"%s\" on %s", username, update_torrents) - client.core.set_torrents_owner(update_torrents, username) + + def failed_change_owner(failure): + dialogs.ErrorDialog( + _("Ownership Change Error"), + _("There was an error while trying changing ownership."), + self.window.window, details=failure.value.logable() + ).run() + client.core.set_torrents_owner( + update_torrents, username).addErrback(failed_change_owner)