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>
|
||||
* pisi/actionsapi/get.py: Add ARCH() for getting host architecture.
|
||||
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"]
|
||||
|
||||
def _set_i18n(self, tag, inst):
|
||||
for summary in tag.tags("Summary"):
|
||||
inst.summary[summary.getAttribute("xml:lang")] = summary.firstChild().data()
|
||||
for desc in tag.tags("Description"):
|
||||
inst.description[desc.getAttribute("xml:lang")] = desc.firstChild().data()
|
||||
try:
|
||||
for summary in tag.tags("Summary"):
|
||||
inst.summary[summary.getAttribute("xml:lang")] = summary.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):
|
||||
if not os.path.exists(path):
|
||||
@@ -323,7 +327,10 @@ class SpecFile(xmlfile.XmlFile):
|
||||
except Exception, e:
|
||||
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 inst in self.packages:
|
||||
if inst.name == pak.getTagData("Name"):
|
||||
|
||||
Reference in New Issue
Block a user