[PATCH eac] Fix UnicodeError on Xml parsing for building Item

Guillaume Vandevelde guillaume.vandevelde at logilab.fr
Thu Aug 29 18:32:54 CEST 2019


# HG changeset patch
# User Guillaume Vandevelde <gvandevelde at logilab.fr>
# Date 1567096076 -7200
#      Thu Aug 29 18:27:56 2019 +0200
# Node ID f9b7668d12050c372e2da9f385940c46c99a0a3a
# Parent  db9143b582968c0d673e982e5466696b55ec265b
# Available At http://hg.logilab.org/review/cubes/eac
#              hg pull http://hg.logilab.org/review/cubes/eac -r f9b7668d1205
Fix UnicodeError on Xml parsing for building Item

diff -r db9143b58296 -r f9b7668d1205 cubicweb_eac/dataimport.py
--- a/cubicweb_eac/dataimport.py	Tue Jul 23 18:36:50 2019 +0200
+++ b/cubicweb_eac/dataimport.py	Thu Aug 29 18:27:56 2019 +0200
@@ -342,7 +342,12 @@
             for child in self._elem_findall(list_elem, 'eac:item'):
                 child.tag = 'li'
             values.append(list_elem)
-        return u"\n".join(etree.tostring(item, encoding='utf-8') for item in values)
+        return u"\n".join(
+            etree.tostring(
+                item, encoding=text_type,
+                method='html').strip()
+            for item in values
+            if len(item) != 0 or item.text)
 
     def record_visited(self, elem, extentity):
         assert extentity.extid, extentity



More information about the saem-devel mailing list