Browse Source

move proxy fallback away from send method

283
thomasv 13 years ago
parent
commit
da9351260c
  1. 7
      lib/interface.py
  2. 5
      lib/simple_config.py

7
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)

5
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:

Loading…
Cancel
Save