jenkins-bot has submitted this change and it was merged.
Change subject: Don't use SSL if not available
......................................................................
Don't use SSL if not available
There might still be some installations
with httplib without HTTPS for some reason.
Don't try to use https on those (in case
of Wikipedia, the use of SSL was actually
forced).
Change-Id: I5809364eb02d8669fc2b62734ca1e3e48824b129
---
M family.py
1 file changed, 13 insertions(+), 2 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/family.py b/family.py
index 30e2bed..30d2dbc 100644
--- a/family.py
+++ b/family.py
@@ -4209,12 +4209,20 @@
return self.namespace(code, 14, all=True)
# Methods
+ def ssl_available(self):
+ """Check if SSL support is available"""
+ import httplib
+ return hasattr(httplib, "HTTPS")
+
def protocol(self, code):
"""
Can be overridden to return 'https'. Other protocols are not supported.
"""
- return 'http%s' % ('', 's')[config.SSL_connection]
+ if self.ssl_available():
+ return 'http%s' % ('', 's')[config.SSL_connection]
+ else:
+ return 'http'
def hostname(self, code):
"""The hostname to use for standard http
connections."""
@@ -4867,4 +4875,7 @@
return ('commons', 'commons')
def protocol(self, code):
- return 'https'
+ if self.ssl_available():
+ return 'https'
+ else:
+ return 'http'
--
To view, visit
https://gerrit.wikimedia.org/r/98396
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5809364eb02d8669fc2b62734ca1e3e48824b129
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/compat
Gerrit-Branch: master
Gerrit-Owner: saper <saper(a)saper.info>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
Gerrit-Reviewer: saper <saper(a)saper.info>