diff --git a/product/ERP5SyncML/Conduit/ERP5Conduit.py b/product/ERP5SyncML/Conduit/ERP5Conduit.py index 7466f1fed90ffb97c5ca2f58683a75e676bee929..13a7335e33a687437d4a4d491dd4bcc01f813e63 100644 --- a/product/ERP5SyncML/Conduit/ERP5Conduit.py +++ b/product/ERP5SyncML/Conduit/ERP5Conduit.py @@ -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) diff --git a/product/ERP5SyncML/Subscription.py b/product/ERP5SyncML/Subscription.py index 1be34aaee100c35d4104431d2dcaa130ca194e97..a187b1205ca7dd7db6315ef6b6b2071d48de75b8 100644 --- a/product/ERP5SyncML/Subscription.py +++ b/product/ERP5SyncML/Subscription.py @@ -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 """ diff --git a/product/ERP5SyncML/XMLSyncUtils.py b/product/ERP5SyncML/XMLSyncUtils.py index de81c1dc736fbdc9e3c39ccb3b4a241caf7952b3..adcb0911caefdab9d4bfae7aafe2ef947b629233 100644 --- a/product/ERP5SyncML/XMLSyncUtils.py +++ b/product/ERP5SyncML/XMLSyncUtils.py @@ -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())