Commit 9b22e41d authored by Sebastien Robin's avatar Sebastien Robin

by Fabien, use the library Ft.Xml instead of xml.dom.minidom in order to make...

by Fabien, use the library Ft.Xml instead of xml.dom.minidom in order to make synchronization faster, and use xpath exression, this make the code much more cleaner

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14478 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c08f67d8
This diff is collapsed.
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
import smtplib # to send emails import smtplib # to send emails
from Publication import Publication,Subscriber from Publication import Publication,Subscriber
from Subscription import Signature from Subscription import Signature
from xml.dom.ext.reader.Sax2 import FromXmlStream, FromXml from Ft.Xml import Parse
from xml.dom.minidom import parse, parseString
from XMLSyncUtils import XMLSyncUtils from XMLSyncUtils import XMLSyncUtils
from Conduit.ERP5Conduit import ERP5Conduit from Conduit.ERP5Conduit import ERP5Conduit
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
...@@ -221,7 +220,7 @@ class PublicationSynchronization(XMLSyncUtils): ...@@ -221,7 +220,7 @@ class PublicationSynchronization(XMLSyncUtils):
if xml_client is not None: if xml_client is not None:
if isinstance(xml_client, str) or isinstance(xml_client, unicode): if isinstance(xml_client, str) or isinstance(xml_client, unicode):
xml_client = parseString(xml_client) xml_client = Parse(xml_client)
first_node = xml_client.childNodes[0] first_node = xml_client.childNodes[0]
if first_node.nodeName != "SyncML": if first_node.nodeName != "SyncML":
......
...@@ -28,9 +28,7 @@ ...@@ -28,9 +28,7 @@
import smtplib # to send emails import smtplib # to send emails
from Subscription import Subscription,Signature from Subscription import Subscription,Signature
from xml.dom.ext.reader.Sax2 import FromXmlStream, FromXml from Ft.Xml import Parse
from xml.dom.minidom import parse, parseString
from xml.dom.ext import PrettyPrint
from XMLSyncUtils import XMLSyncUtils from XMLSyncUtils import XMLSyncUtils
import commands import commands
from Conduit.ERP5Conduit import ERP5Conduit from Conduit.ERP5Conduit import ERP5Conduit
...@@ -99,7 +97,7 @@ class SubscriptionSynchronization(XMLSyncUtils): ...@@ -99,7 +97,7 @@ class SubscriptionSynchronization(XMLSyncUtils):
else: else:
xml_client = msg xml_client = msg
if isinstance(xml_client, str) or isinstance(xml_client, unicode): if isinstance(xml_client, str) or isinstance(xml_client, unicode):
xml_client = parseString(xml_client) xml_client = Parse(xml_client)
next_status = self.getNextSyncBodyStatus(xml_client, None) next_status = self.getNextSyncBodyStatus(xml_client, None)
#LOG('readResponse, next status :',0,next_status) #LOG('readResponse, next status :',0,next_status)
if next_status is not None: if next_status is not None:
......
...@@ -40,8 +40,7 @@ from Products.ERP5SyncML import Conduit ...@@ -40,8 +40,7 @@ from Products.ERP5SyncML import Conduit
from Publication import Publication,Subscriber from Publication import Publication,Subscriber
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2 from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2
from Subscription import Subscription,Signature from Subscription import Subscription,Signature
from xml.dom.ext.reader.Sax2 import FromXmlStream, FromXml from Ft.Xml import Parse
from xml.dom.minidom import parse, parseString
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from PublicationSynchronization import PublicationSynchronization from PublicationSynchronization import PublicationSynchronization
from SubscriptionSynchronization import SubscriptionSynchronization from SubscriptionSynchronization import SubscriptionSynchronization
...@@ -50,7 +49,6 @@ from AccessControl.SecurityManagement import newSecurityManager ...@@ -50,7 +49,6 @@ from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.User import UnrestrictedUser from AccessControl.User import UnrestrictedUser
from Acquisition import aq_base from Acquisition import aq_base
from xml.parsers.expat import ExpatError # parseString error
import urllib import urllib
import urllib2 import urllib2
import socket import socket
...@@ -974,7 +972,7 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -974,7 +972,7 @@ class SynchronizationTool( SubscriptionSynchronization,
commands.getstatusoutput('rm -f /tmp/%s.gz.gpg' % filename) commands.getstatusoutput('rm -f /tmp/%s.gz.gpg' % filename)
# Get the target and then find the corresponding publication or # Get the target and then find the corresponding publication or
# Subscription # Subscription
xml = parseString(text) xml = Parse(text)
#XXX this function is not very optimized and should be improved #XXX this function is not very optimized and should be improved
url = self.getTarget(xml) url = self.getTarget(xml)
for publication in self.getPublicationList(): for publication in self.getPublicationList():
......
This diff is collapsed.
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