From c185450930468a86caf1f370e500f6e5f6fc8ece Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Fri, 16 Jul 2004 11:51:40 +0000
Subject: [PATCH] replace object by object_id

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1207 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5SyncML/Subscription.py | 20 ++++++++++----------
 product/ERP5SyncML/XMLSyncUtils.py |  9 ++++++---
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/product/ERP5SyncML/Subscription.py b/product/ERP5SyncML/Subscription.py
index be31619a64..5e84079b00 100755
--- a/product/ERP5SyncML/Subscription.py
+++ b/product/ERP5SyncML/Subscription.py
@@ -262,7 +262,7 @@ class Signature(Folder,SyncCode):
       # XXX This may be a problem, if the document is changed
       # during a synchronization
       self.setLastSynchronizationDate(DateTime())
-      self.getParent().removeRemainingObject(self.getObject())
+      self.getParent().removeRemainingObjectId(self.getId())
     if status == self.NOT_SYNCHRONIZED:
       self.setTempXML(None)
       self.setPartialXML(None)
@@ -1007,32 +1007,32 @@ class Subscription(Folder, SyncCode):
       conflict_list += signature.getConflictList()
     return conflict_list
 
-  def getRemainingObjectList(self):
+  def getRemainingObjectIdList(self):
     """
     We should now wich objects should still
     synchronize
     """
-    return getattr(self,'remaining_object_list',None)
+    return getattr(self,'remaining_object_id_list',None)
 
-  def setRemainingObjectList(self, value):
+  def setRemainingObjectIdList(self, value):
     """
     We should now wich objects should still
     synchronize
     """
-    setattr(self,'remaining_object_list',value)
+    setattr(self,'remaining_object_id_list',value)
 
-  def removeRemainingObject(self, object):
+  def removeRemainingObjectId(self, object_id):
     """
     We should now wich objects should still
     synchronize
     """
-    remaining_object_list = self.getRemainingObjectList()
+    remaining_object_list = self.getRemainingObjectIdList()
     if remaining_object_list is not None:
       new_list = []
       for o in remaining_object_list:
-        if o != object:
+        if o != object_id:
           new_list.append(o)
-      self.setRemainingObjectList(new_list)
+      self.setRemainingObjectIdList(new_list)
 
 #  def getCurrentObject(self):
 #    """
@@ -1059,4 +1059,4 @@ class Subscription(Folder, SyncCode):
         o.setStatus(self.NOT_SYNCHRONIZED)
         o.setPartialXML(None)
         o.setTempXML(None)
-    self.setRemainingObjectList(None)
+    self.setRemainingObjectIdList(None)
diff --git a/product/ERP5SyncML/XMLSyncUtils.py b/product/ERP5SyncML/XMLSyncUtils.py
index 579b94ab05..0194ad683a 100755
--- a/product/ERP5SyncML/XMLSyncUtils.py
+++ b/product/ERP5SyncML/XMLSyncUtils.py
@@ -556,9 +556,11 @@ class XMLSyncUtilsMixin(SyncCode):
     local_gid_list = []
     syncml_data = ''
 
-    if subscriber.getRemainingObjectList() is None:
+    if subscriber.getRemainingObjectIdList() is None:
       object_list = domain.getObjectList()
-      subscriber.setRemainingObjectList(object_list)
+      object_id_list = map(lambda x: x.id,object_list)
+      LOG('getSyncMLData, object_id_list',0,object_id_list)
+      subscriber.setRemainingObjectIdList(object_id_list)
 
       #object_gid = domain.getGidFromObject(object)
       local_gid_list = map(lambda x: domain.getGidFromObject(x),object_list)
@@ -578,7 +580,8 @@ class XMLSyncUtilsMixin(SyncCode):
 
 
     #for object in domain.getObjectList():
-    for object in subscriber.getRemainingObjectList():
+    for object_id in subscriber.getRemainingObjectIdList():
+      object = subscriber.getDestination()._getOb(object_id)
       status = self.SENT
       #gid_generator = getattr(object,domain.getGidGenerator(),None)
       object_gid = domain.getGidFromObject(object)
-- 
2.30.9