fixed bug in broken-add-ons blacklist script.
made wmlparser2 more resilient against non-utf8 input.
This commit is contained in:
parent
003b56cb17
commit
9aa011ddab
2 changed files with 6 additions and 4 deletions
|
@ -30,7 +30,7 @@ def parse_test(wml, d):
|
|||
return all
|
||||
|
||||
def get_userdir():
|
||||
if options.config_dir: return config_dir
|
||||
if options.config_dir: return options.config_dir
|
||||
p = subprocess.Popen([options.wesnoth, "--config-path"],
|
||||
stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
|
|
|
@ -61,10 +61,11 @@ class AttributeNode:
|
|||
def get_text(self, translation = None):
|
||||
r = u""
|
||||
for s in self.value:
|
||||
ustr = s.data.decode("utf8", "ignore")
|
||||
if translation:
|
||||
r += translation(s.data.decode("utf8"), s.textdomain)
|
||||
r += translation(ustr, s.textdomain)
|
||||
else:
|
||||
r += s.data.decode("utf8")
|
||||
r += ustr
|
||||
return r
|
||||
|
||||
class TagNode:
|
||||
|
@ -343,7 +344,8 @@ class Parser:
|
|||
self.parent_node = self.parent_node[:-1]
|
||||
else:
|
||||
node = TagNode(tag)
|
||||
self.parent_node[-1].append(node)
|
||||
if self.parent_node:
|
||||
self.parent_node[-1].append(node)
|
||||
self.parent_node.append(node)
|
||||
self.parse_outside_strings(line[end + 1:])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue