chiark / gitweb /
checkupdates: Ignore xml tags in string content
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 30 Sep 2015 23:34:02 +0000 (16:34 -0700)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 30 Sep 2015 23:35:41 +0000 (16:35 -0700)
This allows us to fetch strings like the following:

<string name="app_name">foo <xliff:g>bar</xliff:g></string>

Up until now, using .text would only return "foo ", but if we use .tostring()
with the text method, it converts everything into plain text for us resulting
in "foo bar".

fdroidserver/common.py

index 4c3597f2ad8d332bc4f6aef9f84cffc20ef24435..a79a4fe4bf78939a287da3fc43107d1674081630 100644 (file)
@@ -911,7 +911,7 @@ def retrieve_string(app_dir, string, xmlfiles=None):
     def element_content(element):
         if element.text is None:
             return ""
-        return element.text.encode('utf-8')
+        return XMLElementTree.tostring(element, encoding='utf-8', method='text')
 
     for path in xmlfiles:
         if not os.path.isfile(path):