workflows: fix removal of existing form_details odt section (#52694)
This commit is contained in:
parent
71e5a74898
commit
17b135023d
|
@ -3645,7 +3645,12 @@ def test_export_to_model_form_details_section(pub, filename):
|
|||
new_content = force_text(
|
||||
zipfile.ZipFile(open(formdata.evolution[0].parts[0].filename, 'rb')).read('content.xml')
|
||||
)
|
||||
assert 'Titre de page' not in new_content # section contents has been replaced
|
||||
# section content has been removed
|
||||
assert 'Titre de page' not in new_content
|
||||
assert 'Titre' not in new_content
|
||||
assert 'Libellé de champ' not in new_content
|
||||
assert 'Valeur de champ' not in new_content
|
||||
# and new content has been inserted
|
||||
assert '>Page 1<' in new_content
|
||||
assert '>Title<' in new_content
|
||||
assert '>Subtitle<' in new_content
|
||||
|
|
|
@ -572,7 +572,8 @@ 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:
|
||||
children = [x for x in node]
|
||||
for child in children:
|
||||
node.remove(child)
|
||||
self.insert_form_details(node, formdata)
|
||||
|
||||
|
@ -622,7 +623,8 @@ class ExportToModel(WorkflowStatusItem):
|
|||
)
|
||||
as_node = ET.fromstring(as_str)
|
||||
node.text = as_node.text
|
||||
for child in node:
|
||||
children = [x for x in node]
|
||||
for child in children:
|
||||
node.remove(child)
|
||||
for child in as_node:
|
||||
node.append(child)
|
||||
|
|
Loading…
Reference in New Issue