allow utf8 in metadata.txt

This commit is contained in:
Juergen E. Fischer 2013-06-09 10:56:35 +02:00
parent 95dcd96045
commit 8609a41deb
2 changed files with 8 additions and 6 deletions

View File

@ -28,6 +28,7 @@ from PyQt4.QtXml import QDomDocument
from PyQt4.QtNetwork import *
import sys
import os
import codecs
import ConfigParser
import qgis.utils
from qgis.core import *
@ -556,12 +557,10 @@ class Plugins(QObject):
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:

View File

@ -38,6 +38,7 @@ import os.path
import re
import ConfigParser
import warnings
import codecs
#######################
# ERROR HANDLING
@ -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)