Commit 60feb380 authored by Nicolas Delaby's avatar Nicolas Delaby

- use path instead of object for PubSync, SubSync

- modify source code to use activity
(by fabien)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15166 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d88724c6
...@@ -1105,7 +1105,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -1105,7 +1105,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens') roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens')
user = self.getAttribute(xml,'id') user = self.getAttribute(xml,'id')
roles = list(roles) # Needed for CPS, or we have a CPS error roles = list(roles) # Needed for CPS, or we have a CPS error
LOG('local_role: ',0,'user: %s roles: %s' % (repr(user),repr(roles))) #LOG('local_role: ',0,'user: %s roles: %s' % (repr(user),repr(roles)))
#user = roles[0] #user = roles[0]
#roles = roles[1:] #roles = roles[1:]
if xml.nodeName.find(self.local_role_tag)>=0: if xml.nodeName.find(self.local_role_tag)>=0:
...@@ -1122,14 +1122,14 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -1122,14 +1122,14 @@ class ERP5Conduit(XMLSyncUtilsMixin):
""" """
conflict_list = [] conflict_list = []
# We want to add a local role # We want to add a local role
LOG('addLocalPermissionNode, xml',0,xml) #LOG('addLocalPermissionNode, xml',0,xml)
if len(xml.childNodes)>0: if len(xml.childNodes)>0:
roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens') roles = self.convertXmlValue(xml.childNodes[0].data,data_type='tokens')
roles = list(roles) # Needed for CPS, or we have a CPS error roles = list(roles) # Needed for CPS, or we have a CPS error
else: else:
roles = () roles = ()
permission = self.getAttribute(xml,'id') permission = self.getAttribute(xml,'id')
LOG('local_role: ',0,'permission: %s roles: %s' % (repr(permission),repr(roles))) #LOG('local_role: ',0,'permission: %s roles: %s' % (repr(permission),repr(roles)))
#user = roles[0] #user = roles[0]
#roles = roles[1:] #roles = roles[1:]
if xml.nodeName.find(self.local_permission_tag)>=0: if xml.nodeName.find(self.local_permission_tag)>=0:
......
...@@ -222,12 +222,13 @@ class PublicationSynchronization(XMLSyncUtils): ...@@ -222,12 +222,13 @@ class PublicationSynchronization(XMLSyncUtils):
return {'has_response':1,'xml':xml_a} return {'has_response':1,'xml':xml_a}
def PubSync(self, publication, msg=None, RESPONSE=None, subscriber=None): def PubSync(self, publication_path, msg=None, RESPONSE=None, subscriber=None):
""" """
This is the synchronization method for the server This is the synchronization method for the server
""" """
#LOG('PubSync',0,'Starting... publication: %s' % str(publication)) #LOG('PubSync',0,'Starting... publication: %s' % str(publication_path))
# Read the request from the client # Read the request from the client
publication = self.unrestrictedTraverse(publication_path)
xml_client = msg xml_client = msg
if xml_client is None: if xml_client is None:
xml_client = self.readResponse(from_url=publication.getPublicationUrl()) xml_client = self.readResponse(from_url=publication.getPublicationUrl())
......
...@@ -1039,10 +1039,12 @@ class Subscription(Folder, SyncCode): ...@@ -1039,10 +1039,12 @@ class Subscription(Folder, SyncCode):
o_id = signature.getObjectId() o_id = signature.getObjectId()
#try with id param too, because gid is not catalogged #try with id param too, because gid is not catalogged
object_list = self.getObjectList(gid = b16decode(gid), id = o_id) object_list = self.getObjectList(gid = b16decode(gid), id = o_id)
#LOG('getObjectFromGid :',0,'object_list=%s, gid=%s, o_id=%s' % (object_list, gid, o_id))
if o is not None and o in object_list: if o is not None and o in object_list:
return o return o
#XXX Slow !!! #LOG('entering in the slow loop of getObjectFromGid !!!',0,'')
object_list = self.getObjectList(gid = b16decode(gid)) object_list = self.getObjectList(gid = b16decode(gid))
#LOG('getObjectFromGid :', 0, 'object_list slow loop=%s, gid=%s' % (object_list, gid))
for o in object_list: for o in object_list:
o_gid = self.getGidFromObject(o) o_gid = self.getGidFromObject(o)
if o_gid == gid: if o_gid == gid:
...@@ -1055,7 +1057,6 @@ class Subscription(Folder, SyncCode): ...@@ -1055,7 +1057,6 @@ class Subscription(Folder, SyncCode):
return the object corresponding to the id return the object corresponding to the id
""" """
object_list = self.getObjectList(id=id) object_list = self.getObjectList(id=id)
#XXX very slow with lot of objects
o = None o = None
for object in object_list: for object in object_list:
if object.getId() == id: if object.getId() == id:
......
...@@ -79,12 +79,12 @@ class SubscriptionSynchronization(XMLSyncUtils): ...@@ -79,12 +79,12 @@ class SubscriptionSynchronization(XMLSyncUtils):
return {'has_response':1,'xml':xml_a} return {'has_response':1,'xml':xml_a}
def SubSync(self, subscription, msg=None, RESPONSE=None): def SubSync(self, subscription_path, msg=None, RESPONSE=None):
""" """
This is the synchronization method for the client This is the synchronization method for the client
""" """
response = None #check if subsync replies to this messages response = None #check if subsync replies to this messages
subscription = self.unrestrictedTraverse(subscription_path)
if msg==None and (subscription.getSubscriptionUrl()).find('file')>=0: if msg==None and (subscription.getSubscriptionUrl()).find('file')>=0:
msg = self.readResponse(sync_id=subscription.getSourceURI(), msg = self.readResponse(sync_id=subscription.getSourceURI(),
from_url=subscription.getSubscriptionUrl()) from_url=subscription.getSubscriptionUrl())
......
...@@ -68,7 +68,8 @@ class SyncCode(Persistent): ...@@ -68,7 +68,8 @@ class SyncCode(Persistent):
PUB_CONFLICT_MERGE = 6 PUB_CONFLICT_MERGE = 6
PUB_CONFLICT_CLIENT_WIN = 8 PUB_CONFLICT_CLIENT_WIN = 8
MAX_LINES = 1000 MAX_LINES = 5000
MAX_OBJECTS = 100
action_tag = 'workflow_action' action_tag = 'workflow_action'
#NOT_EDITABLE_PROPERTY = ('id','object','uid','xupdate:element',action_tag, #NOT_EDITABLE_PROPERTY = ('id','object','uid','xupdate:element',action_tag,
......
...@@ -341,7 +341,7 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -341,7 +341,7 @@ class SynchronizationTool( SubscriptionSynchronization,
""" """
reset a subscription reset a subscription
""" """
self.SubSync(self.getSubscription(title)) self.SubSync(self.getSubscription(title).getPath())
if RESPONSE is not None: if RESPONSE is not None:
RESPONSE.redirect('manageSubscriptions') RESPONSE.redirect('manageSubscriptions')
...@@ -512,6 +512,7 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -512,6 +512,7 @@ class SynchronizationTool( SubscriptionSynchronization,
#LOG('getSynchronizationState, subscriber_list:',0,subscriber_list) #LOG('getSynchronizationState, subscriber_list:',0,subscriber_list)
for subscriber in subscriber_list: for subscriber in subscriber_list:
signature = subscriber.getSignatureFromObjectId(o_id) signature = subscriber.getSignatureFromObjectId(o_id)
#XXX check if signature could be not None ...
if signature is not None: if signature is not None:
state = signature.getStatus() state = signature.getStatus()
#LOG('getSynchronizationState:',0,'sub.dest :%s, state: %s' % \ #LOG('getSynchronizationState:',0,'sub.dest :%s, state: %s' % \
...@@ -861,16 +862,20 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -861,16 +862,20 @@ class SynchronizationTool( SubscriptionSynchronization,
if send: if send:
if isinstance(to_url, str): if isinstance(to_url, str):
if to_url.find('http://')==0: if to_url.find('http://')==0:
domain = aq_base(domain)
#LOG('domain.domain_type',0,domain.domain_type)
#LOG("getattr(domain, 'getActivityEnabled', None)",0,getattr(domain, 'getActivityEnabled', None))
#LOG("domain.getActivityEnabled()",0,domain.getActivityEnabled())
if domain.domain_type == self.PUB and not domain.getActivityEnabled():
# not use activity
# XXX Make sure this is not a problem # XXX Make sure this is not a problem
if domain.domain_type == self.PUB:
return None return None
# we will send an http response #use activities to send send an http response
domain = aq_base(domain)
#LOG('sendResponse, will start sendHttpResponse, xml',0,'') #LOG('sendResponse, will start sendHttpResponse, xml',0,'')
self.activate(activity='RAMQueue').sendHttpResponse(sync_id=sync_id, self.activate(activity='RAMQueue').sendHttpResponse(sync_id=sync_id,
to_url=to_url, to_url=to_url,
xml=xml, domain=domain) xml=xml,
return None domain_path=domain.getPath())
elif to_url.find('file://')==0: elif to_url.find('file://')==0:
filename = to_url[len('file:/'):] filename = to_url[len('file:/'):]
stream = file(filename,'w') stream = file(filename,'w')
...@@ -886,12 +891,14 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -886,12 +891,14 @@ class SynchronizationTool( SubscriptionSynchronization,
return xml return xml
security.declarePrivate('sendHttpResponse') security.declarePrivate('sendHttpResponse')
def sendHttpResponse(self, to_url=None, sync_id=None, xml=None, domain=None ): def sendHttpResponse(self, to_url=None, sync_id=None, xml=None,
domain_path=None ):
domain = self.unrestrictedTraverse(domain_path)
#LOG('sendHttpResponse, self.getPhysicalPath: ',0,self.getPhysicalPath()) #LOG('sendHttpResponse, self.getPhysicalPath: ',0,self.getPhysicalPath())
#LOG('sendHttpResponse, starting with domain:',0,domain) #LOG('sendHttpResponse, starting with domain:',0,domain)
#LOG('sendHttpResponse, xml:',0,xml) #LOG('sendHttpResponse, xml:',0,xml)
if domain is not None: if domain is not None:
if domain.domain_type == self.PUB: if domain.domain_type == self.PUB and not domain.getActivityEnabled():
return xml return xml
# Retrieve the proxy from os variables # Retrieve the proxy from os variables
proxy_url = '' proxy_url = ''
...@@ -928,7 +935,7 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -928,7 +935,7 @@ class SynchronizationTool( SubscriptionSynchronization,
result = urllib2.urlopen(request).read() result = urllib2.urlopen(request).read()
except socket.error, msg: except socket.error, msg:
self.activate(activity='RAMQueue').sendHttpResponse(to_url=to_url, self.activate(activity='RAMQueue').sendHttpResponse(to_url=to_url,
sync_id=sync_id, xml=xml, domain=domain) sync_id=sync_id, xml=xml, domain_path=domain.getPath())
LOG('sendHttpResponse, socket ERROR:',0,msg) LOG('sendHttpResponse, socket ERROR:',0,msg)
LOG('sendHttpResponse, url,data',0,(url, data)) LOG('sendHttpResponse, url,data',0,(url, data))
return return
...@@ -940,7 +947,8 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -940,7 +947,8 @@ class SynchronizationTool( SubscriptionSynchronization,
#LOG('sendHttpResponse, before result, domain:',0,domain) #LOG('sendHttpResponse, before result, domain:',0,domain)
if domain is not None: if domain is not None:
if domain.domain_type == self.SUB: if domain.domain_type == self.SUB and not domain.getActivityEnabled():
#if we don't use activity :
gpg_key = domain.getGPGKey() gpg_key = domain.getGPGKey()
if result not in (None,''): if result not in (None,''):
#if gpg_key not in ('',None): #if gpg_key not in ('',None):
...@@ -965,8 +973,8 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -965,8 +973,8 @@ class SynchronizationTool( SubscriptionSynchronization,
#LOG('sync, message_list:',0,message_list) #LOG('sync, message_list:',0,message_list)
if len(message_list) == 0: if len(message_list) == 0:
for subscription in self.getSubscriptionList(): for subscription in self.getSubscriptionList():
#LOG('sync, subcription:',0,subscription) #LOG('sync, type(subcription):',0,type(subscription))
self.activate(activity='RAMQueue').SubSync(subscription) self.activate(activity='RAMQueue').SubSync(subscription.getPath())
security.declarePublic('readResponse') security.declarePublic('readResponse')
def readResponse(self, text=None, sync_id=None, to_url=None, from_url=None): def readResponse(self, text=None, sync_id=None, to_url=None, from_url=None):
...@@ -1013,13 +1021,20 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -1013,13 +1021,20 @@ 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
#LOG('type(text) : ',0,type(text))
xml = Parse(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():
if publication.getPublicationUrl()==url and \ if publication.getPublicationUrl()==url and \
publication.getTitle()==sync_id: publication.getTitle()==sync_id:
result = self.PubSync(publication,xml) if publication.getActivityEnabled():
#use activities to send SyncML data.
self.activate(activity='RAMQueue').PubSync(publication.getPath(),
text)
return ' '
else:
result = self.PubSync(publication.getPath(),xml)
# Then encrypt the message # Then encrypt the message
xml = result['xml'] xml = result['xml']
#must be commented because this method is alredy called #must be commented because this method is alredy called
...@@ -1029,8 +1044,10 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -1029,8 +1044,10 @@ class SynchronizationTool( SubscriptionSynchronization,
for subscription in self.getSubscriptionList(): for subscription in self.getSubscriptionList():
if subscription.getSubscriptionUrl()==url and \ if subscription.getSubscriptionUrl()==url and \
subscription.getTitle()==sync_id: subscription.getTitle()==sync_id:
result = self.activate(activity='RAMQueue').SubSync(\ subscription_path = self.getSubscription(sync_id).getPath()
self.getSubscription(sync_id), text) self.activate(activity='RAMQueue').SubSync(subscription_path,
text)
return ' '
#result = self.SubSync(self.getSubscription(sync_id),xml) #result = self.SubSync(self.getSubscription(sync_id),xml)
# we use from only if we have a file # we use from only if we have a file
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
import smtplib import smtplib
from Products.ERP5SyncML.SyncCode import SyncCode from Products.ERP5SyncML.SyncCode import SyncCode
from Products.ERP5SyncML.Subscription import Signature from Products.ERP5SyncML.Subscription import Signature
from DateTime import DateTime
from StringIO import StringIO from StringIO import StringIO
from xml.dom.ext import PrettyPrint from xml.dom.ext import PrettyPrint
from ERP5Diff import ERP5Diff from ERP5Diff import ERP5Diff
...@@ -689,6 +688,7 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -689,6 +688,7 @@ class XMLSyncUtilsMixin(SyncCode):
if object is not None, this usually means we want to set the if object is not None, this usually means we want to set the
actual xupdate on the signature. actual xupdate on the signature.
""" """
#LOG('getSyncMLData starting...',0,'')
local_gid_list = [] local_gid_list = []
syncml_data = kw.get('syncml_data','') syncml_data = kw.get('syncml_data','')
result = {'finished':1} result = {'finished':1}
...@@ -702,6 +702,7 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -702,6 +702,7 @@ class XMLSyncUtilsMixin(SyncCode):
#object_gid = domain.getGidFromObject(object) #object_gid = domain.getGidFromObject(object)
local_gid_list = map(lambda x: domain.getGidFromObject(x),object_list) local_gid_list = map(lambda x: domain.getGidFromObject(x),object_list)
# Objects to remove # Objects to remove
#LOG('remove object to remove ...',0,'')
for object_gid in subscriber.getGidList(): for object_gid in subscriber.getGidList():
if not (object_gid in local_gid_list): if not (object_gid in local_gid_list):
# This is an object to remove # This is an object to remove
...@@ -721,6 +722,7 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -721,6 +722,7 @@ class XMLSyncUtilsMixin(SyncCode):
local_gid_list = [] local_gid_list = []
loop = 0 loop = 0
for object_path in subscriber.getRemainingObjectPathList(): for object_path in subscriber.getRemainingObjectPathList():
#LOG('getRemainingObject :',0,[[subscriber.getRemainingObjectPathList()[i][3] for i in range(5)],[subscriber.getRemainingObjectPathList()[-i][3] for i in range(5)]])
if max is not None and loop >= max: if max is not None and loop >= max:
result['finished'] = 0 result['finished'] = 0
break break
...@@ -777,6 +779,9 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -777,6 +779,9 @@ class XMLSyncUtilsMixin(SyncCode):
status = self.PARTIAL status = self.PARTIAL
signature.setAction('Add') signature.setAction('Add')
xml_string = '<!--' + short_string + '-->' xml_string = '<!--' + short_string + '-->'
else:#if there is no partial data,
#we could remove the object from the remain list
subscriber.removeRemainingObjectPath(object_path)
gid = signature.getRid()#in fisrt, we try with rid if there is one gid = signature.getRid()#in fisrt, we try with rid if there is one
if gid == None: if gid == None:
gid = signature.getGid() gid = signature.getGid()
...@@ -964,7 +969,6 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -964,7 +969,6 @@ class XMLSyncUtilsMixin(SyncCode):
if action.nodeName == 'Add': if action.nodeName == 'Add':
# Then store the xml of this new subobject # Then store the xml of this new subobject
if object is None: if object is None:
object_id = domain.generateNewIdWithGenerator(object=destination,gid=gid)
#if object_id is not None: #if object_id is not None:
add_data = conduit.addNode(xml=data_subnode, add_data = conduit.addNode(xml=data_subnode,
object=destination, object_id=object_id) object=destination, object_id=object_id)
...@@ -979,7 +983,6 @@ class XMLSyncUtilsMixin(SyncCode): ...@@ -979,7 +983,6 @@ class XMLSyncUtilsMixin(SyncCode):
else: else:
#Object was retrieve but need to be updated without recreated #Object was retrieve but need to be updated without recreated
#usefull when an object is only deleted by workflow. #usefull when an object is only deleted by workflow.
object_id = domain.generateNewIdWithGenerator(object=destination,gid=gid)
add_data = conduit.addNode(xml=data_subnode, add_data = conduit.addNode(xml=data_subnode,
object=destination, object=destination,
object_id=object_id, object_id=object_id,
...@@ -1309,13 +1312,13 @@ class XMLSyncUtils(XMLSyncUtilsMixin): ...@@ -1309,13 +1312,13 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
# Now we should send confirmations # Now we should send confirmations
cmd_id_before_getsyncmldata = cmd_id cmd_id_before_getsyncmldata = cmd_id
cmd_id = cmd_id+1 cmd_id = cmd_id+1
if getattr(domain, 'getActivityEnabled', None) and domain.getActivityEnabled(): if domain.getActivityEnabled():
#use activities to get SyncML data. #use activities to get SyncML data.
if not (isinstance(remote_xml, str) or isinstance(remote_xml, unicode)): if not (isinstance(remote_xml, str) or isinstance(remote_xml, unicode)):
string_io = StringIO() string_io = StringIO()
PrettyPrint(remote_xml,stream=string_io) PrettyPrint(remote_xml,stream=string_io)
remote_xml = string_io.getvalue() remote_xml = string_io.getvalue()
self.activate().SyncModifActivity( self.activate(activity='RAMQueue').SyncModifActivity(
domain_relative_url = domain.getRelativeUrl(), domain_relative_url = domain.getRelativeUrl(),
remote_xml = remote_xml, remote_xml = remote_xml,
subscriber_relative_url = subscriber.getRelativeUrl(), subscriber_relative_url = subscriber.getRelativeUrl(),
...@@ -1332,25 +1335,30 @@ class XMLSyncUtils(XMLSyncUtilsMixin): ...@@ -1332,25 +1335,30 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
remote_xml=remote_xml, remote_xml=remote_xml,
subscriber=subscriber, subscriber=subscriber,
cmd_id=cmd_id,xml_confirmation=xml_confirmation, cmd_id=cmd_id,xml_confirmation=xml_confirmation,
conduit=conduit) conduit=conduit,
max=self.MAX_OBJECTS)
syncml_data = result['syncml_data'] syncml_data = result['syncml_data']
xml_confirmation = result['xml_confirmation'] xml_confirmation = result['xml_confirmation']
cmd_id = result['cmd_id'] cmd_id = result['cmd_id']
return self.sendSyncModif(syncml_data, cmd_id_before_getsyncmldata, return self.sendSyncModif(syncml_data, cmd_id_before_getsyncmldata,
subscriber, domain, xml_confirmation, subscriber, domain, xml_confirmation,
remote_xml, xml_list, has_status_list, has_response) remote_xml, xml_list, has_status_list,
has_response)
def SyncModifActivity(self, **kw): def SyncModifActivity(self, **kw):
domain = self.unrestrictedTraverse(kw['domain_relative_url']) domain = self.unrestrictedTraverse(kw['domain_relative_url'])
subscriber = self.unrestrictedTraverse(kw['subscriber_relative_url']) subscriber = self.unrestrictedTraverse(kw['subscriber_relative_url'])
conduit = subscriber.getConduit() conduit = subscriber.getConduit()
result = self.getSyncMLData(domain = domain, subscriber = subscriber, result = self.getSyncMLData(domain = domain, subscriber = subscriber,
conduit = conduit, max = 100, **kw) conduit = conduit, max = self.MAX_OBJECTS, **kw)
syncml_data = result['syncml_data'] syncml_data = result['syncml_data']
cmd_id = result['cmd_id']
kw['syncml_data'] = syncml_data kw['syncml_data'] = syncml_data
kw['cmd_id'] = cmd_id
finished = result['finished'] finished = result['finished']
#LOG('finished =',0,finished)
if not finished: if not finished:
self.activate().SyncModifActivity(**kw) self.activate(activity='RAMQueue').SyncModifActivity(**kw)
else: else:
xml_confirmation = result['xml_confirmation'] xml_confirmation = result['xml_confirmation']
cmd_id = result['cmd_id'] cmd_id = result['cmd_id']
......
...@@ -196,10 +196,10 @@ class TestERP5SyncMLMixin: ...@@ -196,10 +196,10 @@ class TestERP5SyncMLMixin:
file.write('') file.write('')
file.close() file.close()
nb_message = 1 nb_message = 1
result = portal_sync.SubSync(subscription) result = portal_sync.SubSync(subscription.getPath())
while result['has_response']==1: while result['has_response']==1:
portal_sync.PubSync(publication) portal_sync.PubSync(publication.getPath())
result = portal_sync.SubSync(subscription) result = portal_sync.SubSync(subscription.getPath())
nb_message += 1 + result['has_response'] nb_message += 1 + result['has_response']
return nb_message return nb_message
...@@ -227,16 +227,16 @@ class TestERP5SyncMLMixin: ...@@ -227,16 +227,16 @@ class TestERP5SyncMLMixin:
file.write('') file.write('')
file.close() file.close()
nb_message = 1 nb_message = 1
result = portal_sync.SubSync(subscription) result = portal_sync.SubSync(subscription.getPath())
while result['has_response']==1: while result['has_response']==1:
# We do thing three times, so that we will test # We do thing three times, so that we will test
# if we manage well duplicate messages # if we manage well duplicate messages
portal_sync.PubSync(publication) portal_sync.PubSync(publication.getPath())
portal_sync.PubSync(publication) portal_sync.PubSync(publication.getPath())
portal_sync.PubSync(publication) portal_sync.PubSync(publication.getPath())
result = portal_sync.SubSync(subscription) result = portal_sync.SubSync(subscription.getPath())
result = portal_sync.SubSync(subscription) result = portal_sync.SubSync(subscription.getPath())
result = portal_sync.SubSync(subscription) result = portal_sync.SubSync(subscription.getPath())
nb_message += 1 + result['has_response'] nb_message += 1 + result['has_response']
return nb_message return nb_message
......
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