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