[Erp5-report] r30174 - /erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Oct 30 17:45:09 CET 2009
Author: nicolas
Date: Fri Oct 30 17:45:08 2009
New Revision: 30174
URL: http://svn.erp5.org?rev=30174&view=rev
Log:
Postpone remove of nodes, because position is used to locate nodes to update or remove
Modified:
erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py
Modified: erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py?rev=30174&r1=30173&r2=30174&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py [utf8] (original)
+++ erp5/trunk/products/ERP5SyncML/Conduit/ERP5DocumentConduit.py [utf8] Fri Oct 30 17:45:08 2009
@@ -86,6 +86,7 @@
from copy import deepcopy
xml_previous = deepcopy(previous_xml)
#retrieve new data
+ node_to_remove_list = []
for subnode in xml_xupdate:
sub_xupdate = self.getSubObjectXupdate(subnode)
attribute = sub_xupdate.attrib.get('select', None)
@@ -109,10 +110,7 @@
data_change[prop_id] = xml
xml_xupdate.remove(subnode)
elif subnode.xpath('name()') in self.XUPDATE_UPDATE:
- #retrieve element in previous_xml
- element = xml.xpath(request)[0]
- element.text = subnode.text
- data_change[prop_id] = xml
+ node_to_remove_list.extend(xml.xpath(request))
xml_xupdate.remove(subnode)
elif subnode.xpath('name()') in self.XUPDATE_INSERT_OR_ADD:
if self.getSubObjectDepth(subnode[0]) == 0:
@@ -141,6 +139,8 @@
data_change[prop_id] = xml
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
if len(data_change):
args = {}
More information about the Erp5-report
mailing list