From 5467655264d84ab614451e69f4ce38977c561ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Fri, 12 Jun 2015 12:26:14 -0500 Subject: [PATCH] Fixing requests.urllib3 warnings --- src/application.py | 2 +- src/controller/buffersController.py | 4 ++-- src/fixes/__init__.py | 8 +++++++- src/fixes/fix_requests_cert_location.py | 9 +++++++++ src/fixes/fix_urllib3_warnings.py | 5 +++++ src/main.py | 2 +- 6 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 src/fixes/fix_requests_cert_location.py create mode 100644 src/fixes/fix_urllib3_warnings.py diff --git a/src/application.py b/src/application.py index d3f8328f..ed23a720 100644 --- a/src/application.py +++ b/src/application.py @@ -5,7 +5,7 @@ if snapshot == False: version = "0.80" update_url = 'http://twblue.es/updates/twblue_ngen.json' else: - version = "9.4" + version = "9.5" update_url = 'http://twblue.es/updates/snapshots_ngen.json' author = u"Manuel Cortéz, Bill Dengler" authorEmail = "manuel@manuelcortez.net" diff --git a/src/controller/buffersController.py b/src/controller/buffersController.py index 6521bb48..4d660219 100644 --- a/src/controller/buffersController.py +++ b/src/controller/buffersController.py @@ -47,8 +47,8 @@ class bufferController(object): def get_event(self, ev): - if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "url" - elif ev.GetKeyCode() == wx.WXK_RETURN: event = "interact" + if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "interact" + elif ev.GetKeyCode() == wx.WXK_RETURN: event = "url" elif ev.GetKeyCode() == wx.WXK_F5: event = "volume_down" elif ev.GetKeyCode() == wx.WXK_F6: event = "volume_up" elif ev.GetKeyCode() == wx.WXK_DELETE and ev.ShiftDown(): event = "clear_list" diff --git a/src/fixes/__init__.py b/src/fixes/__init__.py index 3b9f3ee1..a5dee757 100644 --- a/src/fixes/__init__.py +++ b/src/fixes/__init__.py @@ -1,6 +1,12 @@ # -*- coding: utf-8 -*- """ This module contains some bugfixes for packages used in TWBlue.""" +import sys import fix_arrow # A few new locales for Three languages in arrow. +# import fix_requests_cert_location # For a better compilation in Windows. +import fix_urllib3_warnings # Avoiding some SSL warnings related to Twython. def setup(): - fix_arrow.fix() \ No newline at end of file + fix_arrow.fix() +# if hasattr(sys, "frozen"): +# fix_requests_cert_location.fix() + fix_urllib3_warnings.fix() \ No newline at end of file diff --git a/src/fixes/fix_requests_cert_location.py b/src/fixes/fix_requests_cert_location.py new file mode 100644 index 00000000..f06c884c --- /dev/null +++ b/src/fixes/fix_requests_cert_location.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +import paths + +def where(): + return paths.app_path(r"requests\cacert.pem") + +def fix(): + from requests import certs + certs.where = where \ No newline at end of file diff --git a/src/fixes/fix_urllib3_warnings.py b/src/fixes/fix_urllib3_warnings.py new file mode 100644 index 00000000..5df77334 --- /dev/null +++ b/src/fixes/fix_urllib3_warnings.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +from requests.packages import urllib3 + +def fix(): + urllib3.disable_warnings() \ No newline at end of file diff --git a/src/main.py b/src/main.py index 5efbf7a9..ad870613 100644 --- a/src/main.py +++ b/src/main.py @@ -51,6 +51,7 @@ log = logging.getLogger("main") def setup(): log.debug("Starting " + application.name + " %s" % (application.version,)) config.setup() + fixes.setup() log.debug("Using %s %s" % (platform.system(), platform.architecture()[0])) log.debug("Application path is %s" % (paths.app_path(),)) log.debug("config path is %s" % (paths.config_path(),)) @@ -71,7 +72,6 @@ def setup(): if hasattr(sm.view, "destroy"): sm.view.destroy() del sm - fixes.setup() r = mainController.Controller() r.view.show() r.do_work()