Ticket #1828: 0001-Fix-auth-issue-with-args-passed-to-console.patch

File 0001-Fix-auth-issue-with-args-passed-to-console.patch, 1.2 KB (added by Cas, 13 years ago)
  • deluge/ui/console/commander.py

    From f9d0e4f620456194941066f2dea85d0a137f49b2 Mon Sep 17 00:00:00 2001
    From: Calum Lind <calumlind+deluge@gmail.com>
    Date: Tue, 9 Aug 2011 00:46:12 +0100
    Subject: [PATCH] Fix auth issue with args passed to console
    
    ---
     deluge/ui/console/commander.py |    6 +++++-
     1 files changed, 5 insertions(+), 1 deletions(-)
    
    diff --git a/deluge/ui/console/commander.py b/deluge/ui/console/commander.py
    index 21680c0..2b51da8 100644
    a b def on_connect_fail(reason): 
    137137            print "Could not connect to: %s:%d\n %s"%(host,port,rm) 
    138138            self.do_command("quit") 
    139139 
     140        if not username and host in ("127.0.0.1", "localhost"): 
     141            # No username was provided and it's the localhost, so we can try 
     142            # to grab the credentials from the auth file. 
     143            from deluge.ui.common import get_localhost_auth 
     144            username, password = get_localhost_auth() 
    140145        if host: 
    141146            d = client.connect(host,port,username,password) 
    142147        else: 
    143148            d = client.connect() 
    144149        d.addCallback(on_connect) 
    145150        d.addErrback(on_connect_fail) 
    146