[Erp5-report] r16613 - in /erp5/trunk/products/ERP5SyncML: ./ Conduit/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 25 18:45:53 CEST 2007


Author: nicolas
Date: Tue Sep 25 18:45:53 2007
New Revision: 16613

URL: http://svn.erp5.org?rev=16613&view=rev
Log:
Implement Reset in SyncML API

Modified:
    erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py
    erp5/trunk/products/ERP5SyncML/Subscription.py
    erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py

Modified: erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py?rev=16613&r1=16612&r2=16613&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py (original)
+++ erp5/trunk/products/ERP5SyncML/Conduit/ERP5Conduit.py Tue Sep 25 18:45:53 2007
@@ -274,6 +274,8 @@
                          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)

Modified: erp5/trunk/products/ERP5SyncML/Subscription.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Subscription.py?rev=16613&r1=16612&r2=16613&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Subscription.py (original)
+++ erp5/trunk/products/ERP5SyncML/Subscription.py Tue Sep 25 18:45:53 2007
@@ -812,7 +812,7 @@
 
     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 @@
     """
     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
     """

Modified: erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py?rev=16613&r1=16612&r2=16613&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py (original)
+++ erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py Tue Sep 25 18:45:53 2007
@@ -1122,12 +1122,21 @@
             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 @@
       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())




More information about the Erp5-report mailing list