Changes in etgen


Released version 1.1.0


Fixed two warnings “ResourceWarning: unclosed file <_io.TextIOWrapper name=’…/tests/finan.PaymentOrder-63.xml’ mode=’r’ encoding=’UTF-8’>” caused by etgen.sepa.validate.

New rule for etgen.html.to_rst() : when the value is a string, we now assume that it is raw HTML, which means that we parse it and then process is like normal element tree elements.


html2rst now digests html and body elemtns and provides clearer error messages for unsupported elements

Released version 1.0.0

Version 0.0.4 (released 2018-03-11)

  • use the ElementTree builder (E) from lxml instead of my own implementation based on xml.etree.ElementTree. Though not the easy way. It has a few consequences (see below).

We cannot use E.tostring() any more because the E defined in lxml.etree doesn’t have that method. My extended version of tostring() is now as a global function in etgen.html.

Old code:

from etgen.html import E

New code:

from etgen.html import E, tostring

Same problem for E.iselement and E.to_rst and E.raw.

In lxml we don’t have the hack of adding an underscore to attributes like class which are a reserved in Python. We must convert these cases. Before:

return, class_="active")


return, **{'class': "active"})

Failures saying TypeError: bad argument type: __proxy__(u’ by ‘) are because lxml elements don’t like Django translatable strings. Old code:

return E.div(E.h2(, e)

New code:

return E.div(E.h2(str(, e)

Another failure was in code which updates existing elements TypeError: update() takes no keyword arguments. Old code:


New code:

e.set('align', 'right')

Version 0.0.3 (released 2018-02-16)

Version 0.0.2 (released 2018-02-16)

Added package data in etgen/sepa/XSD/*.xsd.

Version 0.0.1 (released 2018-02-16)

The package was born as a repackaging of code which was previously in Lino as the packages lino.utils.xmlgen and lino.utils.html2rst. We moved them out of Lino into an independent package etgen because they might be of use also for projects which don’t use Lino.