Add an extra strip() to work around tostring issue

In cases like this xml code:

	<string name="app_name">"OpenKeychain"</string>
	<!-- title -->
	<string name="title_encrypt_text">"Encrypt"</string>

tostring() returns trailing whitespaces (including newlines). Which
aren't removed until the very end, after we try to remove enclosing
quotes. So strip right after tostring() too, since we never really care
about whitespaces anyway.
This commit is contained in:
Daniel Martí 2015-10-26 00:28:29 +01:00
parent 995afdcbfd
commit 9017328698

View file

@ -914,7 +914,8 @@ def retrieve_string(app_dir, string, xmlfiles=None):
def element_content(element): def element_content(element):
if element.text is None: if element.text is None:
return "" return ""
return XMLElementTree.tostring(element, encoding='utf-8', method='text') s = XMLElementTree.tostring(element, encoding='utf-8', method='text')
return s.strip()
for path in xmlfiles: for path in xmlfiles:
if not os.path.isfile(path): if not os.path.isfile(path):