Module: deluge
Branch: master
Commit: 5bffa3757d5c16d2fb1db38d30343be2df4ba2f4

Author: Pedro Algarvio <pe...@algarvio.me>
Date:   Tue Jul  5 15:29:51 2011 +0100

Don't default to "localclient" as owner unconditionally.

Only set "localclient" as a last resort, first try to find out who is logged in.

---

 deluge/core/torrentmanager.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index fb21e8c..3c289a6 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -345,9 +345,14 @@ class TorrentManager(component.Component):
 
     def add(self, torrent_info=None, state=None, options=None, save_state=True,
             filedump=None, filename=None, magnet=None, resume_data=None,
-            owner='localclient'):
+            owner=Ellipsis):
         """Add a torrent to the manager and returns it's torrent_id"""
 
+        if owner is Ellipsis:
+            owner = component.get("RPCServer").get_session_user()
+            if not owner:
+                owner = "localclient"
+
         if torrent_info is None and state is None and filedump is None and 
magnet is None:
             log.debug("You must specify a valid torrent_info, torrent state or 
magnet.")
             return

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

Reply via email to