Pisi error message sanitization
* pisi/specfile.py (_set_i18n): Handle parsing errors during translations.xml reading. * pisi/specfile.py (read_translations): Ignore source package translations if <Name> is empty in translations.xml.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2010-01-19 Ozan Çağlayan <ozan@pardus.org.tr>
|
||||||
|
* pisi/specfile.py (_set_i18n): Handle parsing errors during
|
||||||
|
translations.xml reading.
|
||||||
|
* pisi/specfile.py (read_translations): Ignore source package
|
||||||
|
translations if <Name> is empty in translations.xml.
|
||||||
|
|
||||||
2010-01-12 Ozan Çağlayan <ozan@pardus.org.tr>
|
2010-01-12 Ozan Çağlayan <ozan@pardus.org.tr>
|
||||||
* pisi/actionsapi/get.py: Add ARCH() for getting host architecture.
|
* pisi/actionsapi/get.py: Add ARCH() for getting host architecture.
|
||||||
Thanks to 64-bit team for pointing out this requirement.
|
Thanks to 64-bit team for pointing out this requirement.
|
||||||
|
|||||||
+12
-5
@@ -310,10 +310,14 @@ class SpecFile(xmlfile.XmlFile):
|
|||||||
self.source.description["en"] = self.source.summary["en"]
|
self.source.description["en"] = self.source.summary["en"]
|
||||||
|
|
||||||
def _set_i18n(self, tag, inst):
|
def _set_i18n(self, tag, inst):
|
||||||
for summary in tag.tags("Summary"):
|
try:
|
||||||
inst.summary[summary.getAttribute("xml:lang")] = summary.firstChild().data()
|
for summary in tag.tags("Summary"):
|
||||||
for desc in tag.tags("Description"):
|
inst.summary[summary.getAttribute("xml:lang")] = summary.firstChild().data()
|
||||||
inst.description[desc.getAttribute("xml:lang")] = desc.firstChild().data()
|
for desc in tag.tags("Description"):
|
||||||
|
inst.description[desc.getAttribute("xml:lang")] = desc.firstChild().data()
|
||||||
|
except AttributeError:
|
||||||
|
raise Error(_("translations.xml file is badly formed."))
|
||||||
|
|
||||||
|
|
||||||
def read_translations(self, path):
|
def read_translations(self, path):
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -323,7 +327,10 @@ class SpecFile(xmlfile.XmlFile):
|
|||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise Error(_("File '%s' has invalid XML") % (path) )
|
raise Error(_("File '%s' has invalid XML") % (path) )
|
||||||
|
|
||||||
self._set_i18n(doc.getTag("Source"), self.source)
|
if doc.getTag("Source").getTagData("Name") == self.source.name:
|
||||||
|
# Set source package translations
|
||||||
|
self._set_i18n(doc.getTag("Source"), self.source)
|
||||||
|
|
||||||
for pak in doc.tags("Package"):
|
for pak in doc.tags("Package"):
|
||||||
for inst in self.packages:
|
for inst in self.packages:
|
||||||
if inst.name == pak.getTagData("Name"):
|
if inst.name == pak.getTagData("Name"):
|
||||||
|
|||||||
Reference in New Issue
Block a user