Commit 5fc0276a authored by Nicolas Delaby's avatar Nicolas Delaby

Use method define on Conduit convertToXml to convert string to etree.

XML namespaces handling will be redesign soon


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29474 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 67a5899d
......@@ -654,6 +654,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
xml_copy = deepcopy(xml)
if xml.nsmap is None or xml.nsmap == {}:
object_element = xml_copy.find(self.xml_object_tag)
if object_element is None and xml_copy.tag == self.xml_object_tag:
object_element = xml_copy
id_element = object_element.find('id')
else:
object_element = xml_copy.xpath('//syncml:object',
......
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
......@@ -1009,14 +1010,11 @@ class XMLSyncUtilsMixin(SyncCode):
# Object was retrieve but need to be updated without recreated
# usefull when an object is only deleted by workflow.
if data_subnode is not None:
if isinstance(data_subnode, str):
xml_string = etree.XML(data_subnode)
else:
xml_string = data_subnode
actual_xml = conduit.getXMLFromObjectWithId(object,\
xml_string = conduit.convertToXml(data_subnode)
actual_xml = conduit.getXMLFromObjectWithId(object,
xml_mapping=domain.getXMLMapping(force=1))
actual_xml = conduit.convertToXml(actual_xml)
xml_string_gid = conduit.replaceIdFromXML(xml_string, gid)
actual_xml = etree.XML(actual_xml)
actual_xml_gid = conduit.replaceIdFromXML(actual_xml, gid)
# use gid as compare key because their ids can be different
data_subnode = self.getXupdateObject(xml_string_gid, actual_xml_gid)
......
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