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

Only set "localclient" as a last resort, first try to find out who is logged in.
This commit is contained in:
Pedro Algarvio 2011-07-05 15:29:51 +01:00
parent 8b6d6e3836
commit 5bffa3757d
1 changed files with 6 additions and 1 deletions

View File

@ -345,9 +345,14 @@ class TorrentManager(component.Component):
def add(self, torrent_info=None, state=None, options=None, save_state=True, def add(self, torrent_info=None, state=None, options=None, save_state=True,
filedump=None, filename=None, magnet=None, resume_data=None, 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""" """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: 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.") log.debug("You must specify a valid torrent_info, torrent state or magnet.")
return return