Commit 888345ff authored by Nicolas Delaby's avatar Nicolas Delaby

Follow API upgrades from ERP5Diff

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18826 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 55823f5c
...@@ -50,6 +50,7 @@ try: ...@@ -50,6 +50,7 @@ try:
from Ft.Xml.Domlette import PrettyPrint from Ft.Xml.Domlette import PrettyPrint
except ImportError: except ImportError:
from xml.dom.ext import PrettyPrint from xml.dom.ext import PrettyPrint
from xml.dom import minidom
class XMLSyncUtilsMixin(SyncCode): class XMLSyncUtilsMixin(SyncCode):
...@@ -449,14 +450,14 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -449,14 +450,14 @@ class XMLSyncUtilsMixin(SyncCode):
""" """
erp5diff = ERP5Diff() erp5diff = ERP5Diff()
erp5diff.compare(old_xml, object_xml) erp5diff.compare(old_xml, object_xml)
#minidom is buggy, add namespace declaration, and version, only if attribute version doesn't exists if isinstance(erp5diff._result, minidom.Document):
ns = 'http://www.xmldb.org/xupdate' #XXX While ERP5Diff use minidom, this part needs to be keeped.
if not erp5diff._result.documentElement.hasAttributeNS(ns, 'version'): #minidom is buggy, add namespace declaration, and version attributes
attr_version = erp5diff._result.createAttributeNS(ns, 'version') attr_version = erp5diff._result.createAttributeNS(None, 'version')
attr_version.value = '1.0' attr_version.value = '1.0'
erp5diff._result.documentElement.setAttributeNodeNS(attr_version) erp5diff._result.documentElement.setAttributeNodeNS(attr_version)
attr_ns = erp5diff._result.createAttributeNS(ns, 'xmlns:xupdate') attr_ns = erp5diff._result.createAttributeNS(None, 'xmlns:xupdate')
attr_ns.value = ns attr_ns.value = 'http://www.xmldb.org/xupdate'
erp5diff._result.documentElement.setAttributeNodeNS(attr_ns) erp5diff._result.documentElement.setAttributeNodeNS(attr_ns)
xupdate = erp5diff._result.toxml('utf-8') xupdate = erp5diff._result.toxml('utf-8')
else: else:
......
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