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.
This commit is contained in:
Pedro Algarvio 2011-04-26 08:37:20 +01:00
parent 4432e6e6e3
commit fa20e49a93
2 changed files with 12 additions and 2 deletions

View File

@ -603,7 +603,7 @@ class Core(component.Component):
:raises DelugeError: if the username is not known :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) raise DelugeError("Username \"%s\" is not known." % username)
if isinstance(torrent_ids, basestring): if isinstance(torrent_ids, basestring):
torrent_ids = [torrent_ids] torrent_ids = [torrent_ids]

View File

@ -47,6 +47,7 @@ import deluge.component as component
from deluge.ui.client import client from deluge.ui.client import client
import deluge.common import deluge.common
import common import common
import dialogs
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -554,7 +555,16 @@ class MenuBar(component.Component):
torrent_status = component.get("TorrentView").get_torrent_status(torrent_id) torrent_status = component.get("TorrentView").get_torrent_status(torrent_id)
if torrent_status["owner"] != username: if torrent_status["owner"] != username:
update_torrents.append(torrent_id) update_torrents.append(torrent_id)
if update_torrents: if update_torrents:
log.debug("Setting torrent owner \"%s\" on %s", username, 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)