wf/export_to_model: replace deprecated ET.getchildren method

This commit is contained in:
Nicolas Roche 2020-12-12 13:11:20 +01:00
parent 8d33aa0e82
commit 7b09c48222
1 changed files with 4 additions and 4 deletions

View File

@ -443,7 +443,7 @@ class ExportToModel(WorkflowStatusItem):
styles_node = root.find('{%s}styles' % OO_OFFICE_NS)
if styles_node is None:
return
style_names = set([x.attrib.get('{%s}name' % OO_STYLE_NS) for x in styles_node.getchildren()])
style_names = set([x.attrib.get('{%s}name' % OO_STYLE_NS) for x in styles_node])
for style_name in ['Page_20_Title', 'Form_20_Title', 'Form_20_Subtitle',
'Field_20_Label', 'Field_20_Value']:
# if any style name is defined, don't alter styles
@ -484,7 +484,7 @@ class ExportToModel(WorkflowStatusItem):
# custom behaviour for a section named form_details
# (actually any name containing form_details), create
# real odt markup.
for child in node.getchildren():
for child in node:
node.remove(child)
self.insert_form_details(node, formdata)
@ -530,9 +530,9 @@ class ExportToModel(WorkflowStatusItem):
2 * ('<nsa:line-break xmlns:nsa="%(ns)s"/>' % {'ns': OO_TEXT_NS}))
as_node = ET.fromstring(as_str)
node.text = as_node.text
for child in node.getchildren():
for child in node:
node.remove(child)
for child in as_node.getchildren():
for child in as_node:
node.append(child)
node.tail = current_tail