[nanny] Fix exception ProxyServer not available key



commit 201cec2eca5c8b7389d7437daa39f27a7108d633
Author: Roberto Majadas <roberto majadas openshine com>
Date:   Tue Nov 2 18:39:12 2010 +0100

    Fix exception ProxyServer not available key

 daemon/src/Win32WebContentFiltering.py |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/daemon/src/Win32WebContentFiltering.py b/daemon/src/Win32WebContentFiltering.py
index b81b26b..35082b0 100644
--- a/daemon/src/Win32WebContentFiltering.py
+++ b/daemon/src/Win32WebContentFiltering.py
@@ -201,8 +201,13 @@ class Win32ProxyHelper :
     def set_proxy_http(self, uid, host, port):
         hkey = self.__get_user_internet_settings_hkey(uid)
         try:
-            (val, vtype) = _winreg.QueryValueEx(hkey, "ProxyServer")
-            proxy_servers = str(val)
+            proxy_servers = ''
+            try:
+                (val, vtype) = _winreg.QueryValueEx(hkey, "ProxyServer")
+                proxy_servers = str(val)
+            except:
+                pass
+
             new_proxy_list = ''
 
             previous_http_proxy = False
@@ -238,8 +243,12 @@ class Win32ProxyHelper :
     def del_proxy_http(self, uid):
         hkey = self.__get_user_internet_settings_hkey(uid)
         try:
-            (val, vtype) = _winreg.QueryValueEx(hkey, "ProxyServer")
-            proxy_servers = str(val)
+            proxy_servers = ''
+            try:
+                (val, vtype) = _winreg.QueryValueEx(hkey, "ProxyServer")
+                proxy_servers = str(val)
+            except:
+                pass
 
             new_proxy_list = ''
             for proxy_t in proxy_servers.split(";"):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]