18583N/A--- gnome-applets-2.30.0.orig/invest-applet/invest/__init__.py 2010-04-13 16:22:32.880497570 +0100
18583N/A+++ gnome-applets-2.30.0/invest-applet/invest/__init__.py 2010-04-13 16:23:08.709997679 +0100
18583N/A@@ -3,7 +3,11 @@
18583N/A from types import ListType
18583N/A import datetime
18583N/A
18583N/A-import gtk, gtk.gdk, gconf, gobject
18583N/A+try:
18583N/A+ import gtk, gtk.gdk, gconf, gobject
18583N/A+ from glib import GError
18583N/A+except ImportError:
18583N/A+ sys.exit(1)
18583N/A import cPickle
18583N/A
18583N/A import networkmanager
18583N/A@@ -125,26 +129,34 @@
18583N/A # borrowed from Ross Burton
18583N/A # http://burtonini.com/blog/computers/postr
18583N/A def get_gnome_proxy(client):
18583N/A- if client.get_bool("/system/http_proxy/use_http_proxy"):
18583N/A- host = client.get_string("/system/http_proxy/host")
18583N/A- port = client.get_int("/system/http_proxy/port")
18583N/A- if host is None or host == "" or port == 0:
18583N/A- # gnome proxy is not valid, use enviroment if available
18583N/A- return None
18583N/A-
18583N/A- if client.get_bool("/system/http_proxy/use_authentication"):
18583N/A- user = client.get_string("/system/http_proxy/authentication_user")
18583N/A- password = client.get_string("/system/http_proxy/authentication_password")
18583N/A- if user and user != "":
18583N/A- url = "http://%s:%s@%s:%d" % (user, password, host, port)
18583N/A+ try:
18583N/A+ if client.get_bool("/system/http_proxy/use_http_proxy"):
18583N/A+ host = client.get_string("/system/http_proxy/host")
18583N/A+ port = client.get_int("/system/http_proxy/port")
18583N/A+ if host is None or host == "" or port == 0:
18583N/A+ # gnome proxy is not valid,
18583N/A+ # use enviroment if available
18583N/A+ return None
18583N/A+
18583N/A+ if client.get_bool(
18583N/A+ "/system/http_proxy/use_authentication"):
18583N/A+ user = client.get_string(
18583N/A+ "/system/http_proxy/authentication_user")
18583N/A+ password = client.get_string(
18583N/A+ "/system/http_proxy/authentication_password")
18583N/A+ if user and user != "":
18583N/A+ url = "http://%s:%s@%s:%d" % \
18583N/A+ (user, password, host, port)
18583N/A+ else:
18583N/A+ url = "http://%s:%d" % (host, port)
18583N/A else:
18583N/A url = "http://%s:%d" % (host, port)
18583N/A- else:
18583N/A- url = "http://%s:%d" % (host, port)
18583N/A
18583N/A- return {'http': url}
18583N/A- else:
18583N/A- # gnome proxy is not set, use enviroment if available
18583N/A+ return {'http': url}
18583N/A+ else:
18583N/A+ # gnome proxy is not set, use enviroment if available
18583N/A+ return None
18583N/A+ except GError:
18583N/A return None
18583N/A
18583N/A PROXY = get_gnome_proxy(client)