Commit 3c1745d8 authored by Nicolas Delaby's avatar Nicolas Delaby

Postpone remove of nodes, because position is used to locate nodes to update or remove

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30174 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bc33f7eb
...@@ -86,6 +86,7 @@ class ERP5DocumentConduit(ERP5Conduit): ...@@ -86,6 +86,7 @@ class ERP5DocumentConduit(ERP5Conduit):
from copy import deepcopy from copy import deepcopy
xml_previous = deepcopy(previous_xml) xml_previous = deepcopy(previous_xml)
#retrieve new data #retrieve new data
node_to_remove_list = []
for subnode in xml_xupdate: for subnode in xml_xupdate:
sub_xupdate = self.getSubObjectXupdate(subnode) sub_xupdate = self.getSubObjectXupdate(subnode)
attribute = sub_xupdate.attrib.get('select', None) attribute = sub_xupdate.attrib.get('select', None)
...@@ -109,10 +110,7 @@ class ERP5DocumentConduit(ERP5Conduit): ...@@ -109,10 +110,7 @@ class ERP5DocumentConduit(ERP5Conduit):
data_change[prop_id] = xml data_change[prop_id] = xml
xml_xupdate.remove(subnode) xml_xupdate.remove(subnode)
elif subnode.xpath('name()') in self.XUPDATE_UPDATE: elif subnode.xpath('name()') in self.XUPDATE_UPDATE:
#retrieve element in previous_xml node_to_remove_list.extend(xml.xpath(request))
element = xml.xpath(request)[0]
element.text = subnode.text
data_change[prop_id] = xml
xml_xupdate.remove(subnode) xml_xupdate.remove(subnode)
elif subnode.xpath('name()') in self.XUPDATE_INSERT_OR_ADD: elif subnode.xpath('name()') in self.XUPDATE_INSERT_OR_ADD:
if self.getSubObjectDepth(subnode[0]) == 0: if self.getSubObjectDepth(subnode[0]) == 0:
...@@ -141,6 +139,8 @@ class ERP5DocumentConduit(ERP5Conduit): ...@@ -141,6 +139,8 @@ class ERP5DocumentConduit(ERP5Conduit):
data_change[prop_id] = xml data_change[prop_id] = xml
xml_xupdate.remove(subnode) xml_xupdate.remove(subnode)
#Remove nodes at the end to avoid changing position of elements
[node.getparent().remove(node) for node in node_to_remove_list]
#apply modification #apply modification
if len(data_change): if len(data_change):
args = {} args = {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment