Commit 6366f381 authored by Nicolas Delaby's avatar Nicolas Delaby

Implement Reset in SyncML API

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16613 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da756e44
......@@ -274,6 +274,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
when we have sub objects
"""
conflict_list = []
if xml is None:
return {'conflict_list':conflict_list, 'object':object}
xml = self.convertToXml(xml)
#LOG('ERP5Conduit.updateNode', DEBUG, 'xml.nodeName: %s' % xml.nodeName)
#LOG('ERP5Conduit.updateNode, force: ', DEBUG, force)
......
......@@ -812,7 +812,7 @@ class Subscription(Folder, XMLSyncUtils):
return True if the message id was not seen, False if already seen
"""
last_message_id = getattr(self,'last_message_id',None)
last_message_id = getattr(self, 'last_message_id', None)
#LOG('checkCorrectRemoteMessageId last_message_id = ', DEBUG, last_message_id)
#LOG('checkCorrectRemoteMessageId message_id = ', DEBUG, message_id)
if last_message_id == message_id:
......@@ -832,7 +832,7 @@ class Subscription(Folder, XMLSyncUtils):
"""
return getattr(self, 'last_sent_message', '')
def setLastSentMessage(self,xml):
def setLastSentMessage(self, xml):
"""
This is the setter for the last message we have sent
"""
......
......@@ -1122,12 +1122,21 @@ class XMLSyncUtilsMixin(SyncCode):
reset = 1
#Object was retrieve but need to be updated without recreated
#usefull when an object is only deleted by workflow.
add_data = conduit.addNode(xml=data_subnode,
object=destination,
object_id=object_id,
sub_object=object)
if add_data['conflict_list'] not in ('', None, []):
conflict_list += add_data['conflict_list']
actual_xml = subscriber.getXMLFromObject(object = object, force=1)
if data_subnode is not None:
if type(data_subnode) != type(''):
string_io = StringIO()
PrettyPrint(data_subnode, stream=string_io)
xml_string = string_io.getvalue()
data_subnode = self.getXupdateObject(xml_string, actual_xml)
conflict_list += conduit.updateNode(
xml=data_subnode,
object=object,
previous_xml=signature.getXML(),
force=force,
simulate=simulate)
xml_object = domain.getXMLFromObject(object)
signature.setTempXML(xml_object)
if object is not None:
#LOG('applyActionList', DEBUG, 'addNode, found the object')
if reset:
......@@ -1612,7 +1621,7 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
subscription_url = self.getSubscriptionUrlFromXML(client_header)
# Get the subscriber or create it if not already in the list
subscriber = publication.getSubscriber(subscription_url)
if subscriber == None:
if subscriber is None:
subscriber = Subscriber(publication.generateNewId(), subscription_url)
subscriber.setXMLMapping(publication.getXMLMapping())
subscriber.setConduit(publication.getConduit())
......
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