commit da9351260c68b6ce6cf0685ce5ebb85e34bd1cb4
parent c1fa13d0f64d85cf030ca65dff0a8c9eb369a7b5
Author: thomasv <thomasv@gitorious>
Date: Wed, 10 Oct 2012 10:16:18 +0200
move proxy fallback away from send method
Diffstat:
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/interface.py b/lib/interface.py
@@ -190,14 +190,7 @@ class HttpStratumInterface(PollingInterface):
import urllib2, json, time, cookielib
if self.proxy:
- # This is a friendly fallback to the old style default proxy options
- if(self.proxy["mode"] == "none"):
- simple_config = SimpleConfig()
- simple_config.set_key("proxy", None, True)
- return
-
import socks
-
socks.setdefaultproxy(proxy_modes.index(self.proxy["mode"]), self.proxy["host"], int(self.proxy["port"]) )
socks.wrapmodule(urllib2)
diff --git a/lib/simple_config.py b/lib/simple_config.py
@@ -4,7 +4,6 @@ from util import user_dir
class SimpleConfig:
-
default_options = {
"gui": "lite",
"proxy": None,
@@ -26,6 +25,10 @@ class SimpleConfig:
os.mkdir(self.config_folder)
self.save_config()
+ # This is a friendly fallback to the old style default proxy options
+ if(self.config.get("proxy") is not None and self.config["proxy"]["mode"] == "none"):
+ self.set_key("proxy", None, True)
+
def set_key(self, key, value, save = True):
self.config[key] = value
if save == True: