Skip to content

Commit

Permalink
allow utf8 in metadata.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 9, 2013
1 parent 95dcd96 commit 8609a41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 3 additions & 4 deletions python/pyplugin_installer/installer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from PyQt4.QtNetwork import *
import sys
import os
import codecs
import ConfigParser
import qgis.utils
from qgis.core import *
Expand Down Expand Up @@ -556,12 +557,10 @@ def pluginMetadata(fct):
if not os.path.exists(metadataFile):
return "" # plugin has no metadata.txt file
cp = ConfigParser.ConfigParser()
res = cp.read(metadataFile)
if not len(res):
return "" # failed reading metadata.txt file
try:
cp.readfp(codecs.open(metadataFile, "r", "utf8"))
return cp.get('general', fct)
except Exception:
except:
return ""

if readOnly:
Expand Down
7 changes: 5 additions & 2 deletions python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import re
import ConfigParser
import warnings
import codecs

#######################
# ERROR HANDLING
Expand Down Expand Up @@ -129,8 +130,10 @@ def findPlugins(path):
continue

cp = ConfigParser.ConfigParser()
res = cp.read(metadataFile)
if len(res) == 0:

try:
cp.readfp(codecs.open(metadataFile, "r", "utf8"))
except:
return None # reading of metadata file failed

pluginName = os.path.basename(plugin)
Expand Down

0 comments on commit 8609a41

Please sign in to comment.