Commit 71f04943 authored by Nicolas Delaby's avatar Nicolas Delaby

The select attribute already provide xpath expression, so do not try to recompute it.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30132 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f25f5c52
...@@ -96,17 +96,16 @@ class ERP5DocumentConduit(ERP5Conduit): ...@@ -96,17 +96,16 @@ class ERP5DocumentConduit(ERP5Conduit):
xml = data_change[prop_id] xml = data_change[prop_id]
else: else:
xml = xml_previous.xpath(path_prop_id)[0] xml = xml_previous.xpath(path_prop_id)[0]
num = prop_list[2].split('[')[1].rstrip(']') request = prop_list[-1]
if subnode.xpath('name()') in self.XUPDATE_DEL: if subnode.xpath('name()') in self.XUPDATE_DEL:
request = 'block_data[@num = $num]' node_to_remove_list = xml.xpath(request)
xml.remove(xml.xpath(request, num=num)[0]) if node_to_remove_list:
xml.remove(xml.xpath(request)[0])
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 #retrieve element in previous_xml
request = 'block_data[@num = $num]' element = xml.xpath(request)[0]
element = xml.xpath(request, num=num)[0]
if element is not None:
element.text = subnode.text element.text = subnode.text
data_change[prop_id] = xml data_change[prop_id] = xml
xml_xupdate.remove(subnode) xml_xupdate.remove(subnode)
...@@ -138,7 +137,7 @@ class ERP5DocumentConduit(ERP5Conduit): ...@@ -138,7 +137,7 @@ class ERP5DocumentConduit(ERP5Conduit):
xml_xupdate.remove(subnode) xml_xupdate.remove(subnode)
#apply modification #apply modification
if len(data_change) != 0: if len(data_change):
args = {} args = {}
for key in data_change.keys(): for key in data_change.keys():
node = data_change[key] node = data_change[key]
......
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