From 8e1487d01e6463399b92ec8da92c247c1edf9231 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Fri, 9 Jul 2004 12:12:10 +0000
Subject: [PATCH] try to look at modification date for object in repo

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1133 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5SyncML/XMLSyncUtils.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/product/ERP5SyncML/XMLSyncUtils.py b/product/ERP5SyncML/XMLSyncUtils.py
index 127177a0c6..ef460ff0aa 100755
--- a/product/ERP5SyncML/XMLSyncUtils.py
+++ b/product/ERP5SyncML/XMLSyncUtils.py
@@ -31,6 +31,7 @@ from Products.ERP5SyncML.SyncCode import SyncCode
 from Products.ERP5SyncML.Subscription import Signature
 from xml.dom.ext.reader.Sax2 import FromXml
 from xml.dom.minidom import parse, parseString
+from DateTime import DateTime
 from cStringIO import StringIO
 from xml.dom.ext import PrettyPrint
 import random
@@ -572,9 +573,18 @@ class XMLSyncUtilsMixin(SyncCode):
         LOG('getSyncMLData',0,'alert_code == slowsync: %s' % str(self.getAlertCode(remote_xml)==self.SLOW_SYNC))
         signature = subscriber.getSignature(object_gid)
         LOG('getSyncMLData',0,'current object: %s' % str(object.getId()))
+        # Here we first check if the object was modified or not by looking at dates
         if signature is not None:
           LOG('getSyncMLData',0,'signature.status: %s' % str(signature.getStatus()))
           LOG('getSyncMLData',0,'signature.action: %s' % str(signature.getAction()))
+          last_modification = object.ModificationDate()
+          last_synchronization = signature.getLastSynchronizationDate()
+          parent = object.aq_parent
+          # XXX CPS Specific
+          if parent.id == 'portal_repository':
+            if last_synchronization is not None and last_modification is not None:
+              if last_synchronization > last_modification:
+                signature.setStatus(self.SYNCHRONIZED)
         status = self.SENT
         more_data=0
         # For the case it was never synchronized, we have to send everything
-- 
2.30.9