=== modified file 'UpdateManager/Core/utils.py' --- UpdateManager/Core/utils.py 2009-10-30 11:05:50 +0000 +++ UpdateManager/Core/utils.py 2009-10-30 15:14:09 +0000 @@ -72,6 +72,10 @@ (scheme, netloc, path, querry, fragment) = urlparse.urlsplit(uri) if scheme == "http": import httplib + proxy = os.getenv("http_proxy") + if (proxy): + path = scheme + netloc + path + netloc = proxy try: c = httplib.HTTPConnection(netloc) c.request("HEAD", path) @@ -115,37 +115,38 @@ * then into gconf (if gconfclient was supplied) """ SYNAPTIC_CONF_FILE = "/root/.synaptic/synaptic.conf" - proxy = None + proxy = os.getenv("http_proxy") # generic apt config wins - apt_pkg.InitConfig() - if apt_pkg.Config.Find("Acquire::http::Proxy") != '': - proxy = apt_pkg.Config.Find("Acquire::http::Proxy") - # then synaptic - elif os.path.exists(SYNAPTIC_CONF_FILE): - cnf = apt_pkg.newConfiguration() - apt_pkg.ReadConfigFile(cnf, SYNAPTIC_CONF_FILE) - use_proxy = cnf.FindB("Synaptic::useProxy", False) - if use_proxy: - proxy_host = cnf.Find("Synaptic::httpProxy") - proxy_port = str(cnf.FindI("Synaptic::httpProxyPort")) - if proxy_host and proxy_port: - proxy = "http://%s:%s/" % (proxy_host, proxy_port) - # then gconf - elif gconfclient: - try: # see LP: #281248 - if gconfclient.get_bool("/system/http_proxy/use_http_proxy"): - host = gconfclient.get_string("/system/http_proxy/host") - port = gconfclient.get_int("/system/http_proxy/port") - use_auth = gconfclient.get_bool("/system/http_proxy/use_authentication") - if host and port: - if use_auth: - auth_user = gconfclient.get_string("/system/http_proxy/authentication_user") - auth_pw = gconfclient.get_string("/system/http_proxy/authentication_password") - proxy = "http://%s:%s@%s:%s/" % (auth_user,auth_pw,host, port) - else: - proxy = "http://%s:%s/" % (host, port) - except Exception, e: - print "error from gconf: %s" % e + if not proxy: + apt_pkg.InitConfig() + if apt_pkg.Config.Find("Acquire::http::Proxy") != '': + proxy = apt_pkg.Config.Find("Acquire::http::Proxy") + # then synaptic + elif os.path.exists(SYNAPTIC_CONF_FILE): + cnf = apt_pkg.newConfiguration() + apt_pkg.ReadConfigFile(cnf, SYNAPTIC_CONF_FILE) + use_proxy = cnf.FindB("Synaptic::useProxy", False) + if use_proxy: + proxy_host = cnf.Find("Synaptic::httpProxy") + proxy_port = str(cnf.FindI("Synaptic::httpProxyPort")) + if proxy_host and proxy_port: + proxy = "http://%s:%s/" % (proxy_host, proxy_port) + # then gconf + elif gconfclient: + try: # see LP: #281248 + if gconfclient.get_bool("/system/http_proxy/use_http_proxy"): + host = gconfclient.get_string("/system/http_proxy/host") + port = gconfclient.get_int("/system/http_proxy/port") + use_auth = gconfclient.get_bool("/system/http_proxy/use_authentication") + if host and port: + if use_auth: + auth_user = gconfclient.get_string("/system/http_proxy/authentication_user") + auth_pw = gconfclient.get_string("/system/http_proxy/authentication_password") + proxy = "http://%s:%s@%s:%s/" % (auth_user,auth_pw,host, port) + else: + proxy = "http://%s:%s/" % (host, port) + except Exception, e: + print "error from gconf: %s" % e # if we have a proxy, set it if proxy: # basic verification