mdel: set element text after create it (#62631)

This commit is contained in:
Nicolas Roche 2022-03-11 09:30:10 +01:00
parent dc3f8a60b1
commit b1b80e5fa3
1 changed files with 3 additions and 1 deletions

View File

@ -35,13 +35,15 @@ def parse_date(date):
class ElementFactory(etree.Element):
def __init__(self, *args, **kwargs):
self.text = kwargs.pop('text', None)
text = kwargs.pop('text', None)
namespace = kwargs.pop('namespace', None)
if namespace:
super(ElementFactory, self).__init__(etree.QName(namespace, args[0]), **kwargs)
self.namespace = namespace
else:
super(ElementFactory, self).__init__(*args, **kwargs)
if text:
self.text = text
def append(self, element, allow_new=True):