6330: Can't download ans install addons
svn: r21130
This commit is contained in:
parent
3c75de2327
commit
44ea1b0fa8
@ -35,7 +35,7 @@ import os
|
||||
if sys.version_info[0] < 3:
|
||||
from StringIO import StringIO
|
||||
else:
|
||||
from io import StringIO
|
||||
from io import StringIO, BytesIO
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -219,7 +219,11 @@ def load_addon_file(path, callback=None):
|
||||
callback(_("Unable to open '%s'") % path)
|
||||
return
|
||||
try:
|
||||
buffer = StringIO(fp.read())
|
||||
content = fp.read()
|
||||
if sys.version_info[0] < 3:
|
||||
buffer = StringIO(content)
|
||||
else:
|
||||
buffer = BytesIO(content)
|
||||
except:
|
||||
if callback:
|
||||
callback(_("Error in reading '%s'") % path)
|
||||
|
@ -397,13 +397,15 @@ class ViewManager(CLIManager):
|
||||
lines = list(fp.readlines())
|
||||
count = 0
|
||||
for line in lines:
|
||||
if sys.version_info[0] >= 3:
|
||||
line = line.decode('utf-8').replace(": u'", ": '")
|
||||
try:
|
||||
plugin_dict = safe_eval(line)
|
||||
if type(plugin_dict) != type({}):
|
||||
raise TypeError("Line with addon metadata is not "
|
||||
"a dictionary")
|
||||
except:
|
||||
LOG.debug("Skipped a line in the addon listing: " +
|
||||
LOG.warning("Skipped a line in the addon listing: " +
|
||||
str(line))
|
||||
continue
|
||||
id = plugin_dict["i"]
|
||||
|
Loading…
Reference in New Issue
Block a user