[PATCH eac] remove namespaces in the string generated for items attribute

Denis Laxalde denis.laxalde at logilab.fr
Thu Sep 5 10:21:56 CEST 2019


Guillaume Vandevelde a écrit :
> # HG changeset patch
> # User Guillaume Vandevelde <gvandevelde at logilab.fr>
> # Date 1565270303 -7200
> #      Thu Aug 08 15:18:23 2019 +0200
> # Node ID 23b2a95297e707d62a235f20324445e8ae255c06
> # Parent  268a347314f17a04559a48d3bd851863cb92e158
> # Available At http://hg.logilab.org/review/cubes/eac
> #              hg pull http://hg.logilab.org/review/cubes/eac -r 23b2a95297e7
> remove namespaces in the string generated for items attribute
> 
> diff -r 268a347314f1 -r 23b2a95297e7 cubicweb_eac/dataimport.py
> --- a/cubicweb_eac/dataimport.py	Thu Sep 05 10:10:32 2019 +0200
> +++ b/cubicweb_eac/dataimport.py	Thu Aug 08 15:18:23 2019 +0200
> @@ -21,6 +21,7 @@
>  import copy
>  import json
>  import datetime
> +import re
>  from functools import wraps, partial
>  import inspect
>  import logging
> @@ -343,12 +344,15 @@
>              for child in self._elem_findall(list_elem, 'eac:item'):
>                  child.tag = 'li'
>              values.append(list_elem)
> -        return u"\n".join(
> +        result = u"\n".join(
>              etree.tostring(
>                  item, encoding=text_type,
>                  method='html').strip()
>              for item in values
>              if len(item) != 0 or item.text)
> +        filtered = [e for e in re.split(r'xmlns\S*\"', result)
> +                    if not e.startswith('xmlns')]

Can't this filtering be done when "list_elem" of "values" are built
above?

> +        return u"".join(filtered)
>  
>      def record_visited(self, elem, extentity):
>          assert extentity.extid, extentity



More information about the saem-devel mailing list