mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-11 01:50:59 +00:00
Improved error handling for proxy configuration functions.
This commit is contained in:
parent
2c53507097
commit
8e0fe33edb
1 changed files with 25 additions and 19 deletions
|
|
@ -418,14 +418,17 @@ def get_gconf_http_proxy ():
|
|||
import gconf
|
||||
except ImportError:
|
||||
return None
|
||||
client = gconf.client_get_default()
|
||||
if client.get_bool("/system/http_proxy/use_http_proxy"):
|
||||
host = client.get_string("/system/http_proxy/host")
|
||||
port = client.get_int("/system/http_proxy/port")
|
||||
if host:
|
||||
if not port:
|
||||
port = 8080
|
||||
return "%s:%d" % (host, port)
|
||||
try:
|
||||
client = gconf.client_get_default()
|
||||
if client.get_bool("/system/http_proxy/use_http_proxy"):
|
||||
host = client.get_string("/system/http_proxy/host")
|
||||
port = client.get_int("/system/http_proxy/port")
|
||||
if host:
|
||||
if not port:
|
||||
port = 8080
|
||||
return "%s:%d" % (host, port)
|
||||
except StandardError, msg:
|
||||
log.info(LOG_CHECK, "error getting HTTP proxy from gconf: %s", msg)
|
||||
return None
|
||||
|
||||
|
||||
|
|
@ -435,13 +438,16 @@ def get_gconf_ftp_proxy ():
|
|||
import gconf
|
||||
except ImportError:
|
||||
return None
|
||||
client = gconf.client_get_default()
|
||||
host = client.get_string("/system/proxy/ftp_host")
|
||||
port = client.get_int("/system/proxy/ftp_port")
|
||||
if host:
|
||||
if not port:
|
||||
port = 8080
|
||||
return "%s:%d" % (host, port)
|
||||
try:
|
||||
client = gconf.client_get_default()
|
||||
host = client.get_string("/system/proxy/ftp_host")
|
||||
port = client.get_int("/system/proxy/ftp_port")
|
||||
if host:
|
||||
if not port:
|
||||
port = 8080
|
||||
return "%s:%d" % (host, port)
|
||||
except StandardError, msg:
|
||||
log.info(LOG_CHECK, "error getting FTP proxy from gconf: %s", msg)
|
||||
return None
|
||||
|
||||
|
||||
|
|
@ -454,8 +460,8 @@ def get_kde_http_proxy ():
|
|||
try:
|
||||
data = read_kioslaverc(config_dir)
|
||||
return data.get("http_proxy")
|
||||
except:
|
||||
pass
|
||||
except StandardError, msg:
|
||||
log.info(LOG_CHECK, "error getting HTTP proxy from KDE: %s", msg)
|
||||
|
||||
|
||||
def get_kde_ftp_proxy ():
|
||||
|
|
@ -467,8 +473,8 @@ def get_kde_ftp_proxy ():
|
|||
try:
|
||||
data = read_kioslaverc(config_dir)
|
||||
return data.get("ftp_proxy")
|
||||
except:
|
||||
pass
|
||||
except StandardError, msg:
|
||||
log.info(LOG_CHECK, "error getting FTP proxy from KDE: %s", msg)
|
||||
|
||||
|
||||
def get_kde_config_dir ():
|
||||
|
|
|
|||
Loading…
Reference in a new issue