Skip to content

Commit

Permalink
AddonManager: Further older ssl/urllib2 version support
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jun 9, 2017
1 parent 2ea7a1f commit ab1b344
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/Mod/AddonManager/AddonManager.py
Expand Up @@ -353,7 +353,10 @@ def __init__(self):
def run(self):
"populates the list of addons"
self.progressbar_show.emit(True)
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons",context=ctx)
if ctx:
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons",context=ctx)
else:
u = urllib2.urlopen("https://github.com/FreeCAD/FreeCAD-addons")
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -397,7 +400,10 @@ def run(self):
i = 0
for repo in self.repos:
url = repo[1]
u = urllib2.urlopen(url,context=ctx)
if ctx:
u = urllib2.urlopen(url,context=ctx)
else:
u = urllib2.urlopen(url)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -468,7 +474,10 @@ def run(self):
self.info_label.emit("Downloading list of macros...")
self.progressbar_show.emit(True)
macropath = FreeCAD.ParamGet('User parameter:BaseApp/Preferences/Macro').GetString("MacroPath",os.path.join(FreeCAD.ConfigGet("UserAppData"),"Macro"))
u = urllib2.urlopen("https://www.freecadweb.org/wiki/Macros_recipes",context=ctx)
if ctx:
u = urllib2.urlopen("https://www.freecadweb.org/wiki/Macros_recipes",context=ctx)
else:
u = urllib2.urlopen("https://www.freecadweb.org/wiki/Macros_recipes")
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -510,7 +519,10 @@ def run(self):
else:
url = self.repos[self.idx][1]
self.info_label.emit(translate("AddonsInstaller", "Retrieving info from ") + str(url))
u = urllib2.urlopen(url,context=ctx)
if ctx:
u = urllib2.urlopen(url,context=ctx)
else:
u = urllib2.urlopen(url)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down Expand Up @@ -554,7 +566,10 @@ def run(self):
mac = mac.replace("+","%2B")
url = "https://www.freecadweb.org/wiki/Macro_"+mac
self.info_label.emit("Retrieving info from " + str(url))
u = urllib2.urlopen(url,context=ctx)
if ctx:
u = urllib2.urlopen(url,context=ctx)
else:
u = urllib2.urlopen(url)
p = u.read()
if sys.version_info.major >= 3 and isinstance(p, bytes):
p = p.decode("utf-8")
Expand Down

0 comments on commit ab1b344

Please sign in to comment.