Skip to content

Commit

Permalink
checkloc - explicitly specify namespace(s) when searching
Browse files Browse the repository at this point in the history
Fix for behaviour change in lxml 3.5.0
  • Loading branch information
daveschaefer committed Dec 13, 2015
1 parent 14999ae commit cd23d46
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions checkloc.py
Expand Up @@ -46,7 +46,7 @@
# MAJOR version when you make backwards-incompatible changes,
# MINOR version when you add functionality in a backwards-compatible manner
# PATCH version when you make backwards-compatible bug fixes.
VERSION = "2.1"
VERSION = "2.1.1"

# the en-US translation will have all files and strings created. Use it as the base.
BASE_LOC = 'en-US'
Expand Down Expand Up @@ -477,7 +477,12 @@ def validate_manifests(self):
try:
xml = etree.parse(install_rdf)
root = xml.getroot()
for locale in root.findall('.//em:locale', root.nsmap):
# lxml 3.5.0 raises a ValueError if the namespace map
# contains a 'None' entry, even if it also contains
# other valid mappings.
# Therefore explicitly add only the namespaces we need
ns = {'em': 'http://www.mozilla.org/2004/em-rdf#'}
for locale in root.findall('.//em:locale', ns):
loc = locale.text
if loc not in self.rdf_locs:
self.rdf_locs[loc] = True
Expand Down

0 comments on commit cd23d46

Please sign in to comment.