From fcc975006ad6bf9d81136e7924889ec1a40c9843 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 18 Dec 2008 02:03:41 +0000 Subject: [PATCH] Automatically attempt to get localclient auth when setting core uri to localhost --- deluge/ui/client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deluge/ui/client.py b/deluge/ui/client.py index 2b299444d..4f7924c48 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -309,6 +309,12 @@ class BaseClient(object): def set_core_uri(self, uri='http://localhost:58846'): """Sets the core uri""" + if uri: + # Check if we need to get the localclient auth password + u = urlparse.urlsplit(uri) + if (u.hostname == "localhost" or u.hostname == "127.0.0.1") and not u.username: + from deluge.ui.common import get_localhost_auth_uri + uri = get_localhost_auth_uri(uri) return self.core.set_core_uri(uri) def connected(self):