Fix #1828 : Auth issue with args passed to console

This commit is contained in:
Calum Lind 2011-08-09 00:46:12 +01:00
parent 006624f568
commit b69163b57d
1 changed files with 5 additions and 1 deletions

View File

@ -137,10 +137,14 @@ class Commander:
print "Could not connect to: %s:%d\n %s"%(host,port,rm) print "Could not connect to: %s:%d\n %s"%(host,port,rm)
self.do_command("quit") self.do_command("quit")
if not username and host in ("127.0.0.1", "localhost"):
# No username was provided and it's the localhost, so we can try
# to grab the credentials from the auth file.
from deluge.ui.common import get_localhost_auth
username, password = get_localhost_auth()
if host: if host:
d = client.connect(host,port,username,password) d = client.connect(host,port,username,password)
else: else:
d = client.connect() d = client.connect()
d.addCallback(on_connect) d.addCallback(on_connect)
d.addErrback(on_connect_fail) d.addErrback(on_connect_fail)