Module: deluge
Branch: master
Commit: fa20e49a934ed7202513a314b415499f0e8ac768

Author: Pedro Algarvio <[email protected]>
Date:   Tue Apr 26 08:37:20 2011 +0100

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 6586fff..e04fe25 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 6026f13..f73f9cc 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)
 

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to