Commit a508d9c0 authored by Nicolas Delaby's avatar Nicolas Delaby

If there is multiple attributes to update, only the last one was consider. This fix this issue

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30175 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3c1745d8
...@@ -792,7 +792,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -792,7 +792,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
security.declareProtected(Permissions.AccessContentsInformation,'getElementFromXupdate') security.declareProtected(Permissions.AccessContentsInformation,'getElementFromXupdate')
def getElementFromXupdate(self, xml): def getElementFromXupdate(self, xml):
""" """
from a xupdate:element returns the element as xml return a fragment node with applied xupdate
""" """
if xml.xpath('name()') in self.XUPDATE_ELEMENT: if xml.xpath('name()') in self.XUPDATE_ELEMENT:
new_node = Element(xml.attrib.get('name'), nsmap=xml.nsmap) new_node = Element(xml.attrib.get('name'), nsmap=xml.nsmap)
......
...@@ -127,12 +127,12 @@ class ERP5DocumentConduit(ERP5Conduit): ...@@ -127,12 +127,12 @@ class ERP5DocumentConduit(ERP5Conduit):
for element in self.getXupdateElementList(subnode): for element in self.getXupdateElementList(subnode):
name_element = element.attrib.get('name', None) name_element = element.attrib.get('name', None)
if name_element: if name_element:
attrib_dict = {}
for sub_element in element: for sub_element in element:
if sub_element.xpath('name()') in 'xupdate:attribute': if sub_element.xpath('name()') in 'xupdate:attribute':
name_attribute = sub_element.attrib.get('name') attrib_dict[sub_element.attrib.get('name')] = sub_element.text
value_attribute = sub_element.text
block = etree.SubElement(xml, name_element) block = etree.SubElement(xml, name_element)
block.set(name_attribute, value_attribute) block.attrib.update(attrib_dict)
#change structure in xupdate because is bad formed #change structure in xupdate because is bad formed
value = etree.tostring(element).split('</')[1].split('>')[1] value = etree.tostring(element).split('</')[1].split('>')[1]
block.text = value block.text = value
......
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