Commit c9fa1c6a authored by Nicolas Delaby's avatar Nicolas Delaby

Follow upgrading of ERP5Diff, keep compatibility for older revision

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16856 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 066112c4
...@@ -449,15 +449,19 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -449,15 +449,19 @@ class XMLSyncUtilsMixin(SyncCode):
""" """
erp5diff = ERP5Diff() erp5diff = ERP5Diff()
erp5diff.compare(old_xml, object_xml) erp5diff.compare(old_xml, object_xml)
xupdate_doc = erp5diff._result #minidom is buggy, add namespace declaration, and version, only if attribute version doesn't exists
#minidom is buggy, add namespace declaration, and version ns = 'http://www.xmldb.org/xupdate'
attr_ns = xupdate_doc.createAttribute('xmlns:xupdate') if not erp5diff._result.documentElement.hasAttributeNS(ns, 'version'):
attr_ns.value = 'http://www.xmldb.org/xupdate' attr_version = erp5diff._result.createAttributeNS(ns, 'version')
attr_version = xupdate_doc.createAttribute('version')
attr_version.value = '1.0' attr_version.value = '1.0'
xupdate_doc.documentElement.setAttributeNode(attr_ns) erp5diff._result.documentElement.setAttributeNodeNS(attr_version)
xupdate_doc.documentElement.setAttributeNode(attr_version) attr_ns = erp5diff._result.createAttributeNS(ns, 'xmlns:xupdate')
xupdate = xupdate_doc.toxml('utf-8') attr_ns.value = ns
erp5diff._result.documentElement.setAttributeNodeNS(attr_ns)
xupdate = erp5diff._result.toxml('utf-8')
else:
#Upper version of ERP5Diff produce valid XML.
xupdate = erp5diff.outputString()
#omit xml declaration #omit xml declaration
xupdate = xupdate[xupdate.find('<xupdate:modifications'):] xupdate = xupdate[xupdate.find('<xupdate:modifications'):]
return xupdate return xupdate
......
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