[conduit/syncml: 91/244] Correct the LUID generation logic



commit f725e11fe42e1e6824d244e18ddc90decd0af84d
Author: John Carr <john carr unrouted co uk>
Date:   Fri Apr 24 09:34:31 2009 -0700

    Correct the LUID generation logic
---
 conduit/modules/SyncmlModule/SyncmlModule.py |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/conduit/modules/SyncmlModule/SyncmlModule.py b/conduit/modules/SyncmlModule/SyncmlModule.py
index 0eaedf1..351808f 100644
--- a/conduit/modules/SyncmlModule/SyncmlModule.py
+++ b/conduit/modules/SyncmlModule/SyncmlModule.py
@@ -105,15 +105,20 @@ class SyncmlDataProvider(DataProvider.TwoWay):
         if self._changes == None:
             return 1
 
-        if not uid in self.mapping:
-            self.mapping[uid] = str(uuid.uuid4())
-        LUID = self.mapping[uid]
+        LUID = None
+        for k, v in self.mapping.iteritems():
+            if v == uid:
+                LUID = k
+
+        if LUID == None:
+            LUID = str(uuid.uuid4())
+            self.mapping[LUID] = uid
 
         self._changes[LUID] = (type, data[:size])
 
-        if self._session_type == enums.SML_SESSION_TYPE_CLIENT:
-            err = pysyncml.Error()
-            self.syncobj.add_mapping(source, uid, uid, pysyncml.byref(err))
+        #if self._session_type == enums.SML_SESSION_TYPE_CLIENT:
+        #    err = pysyncml.Error()
+        #    self.syncobj.add_mapping(source, uid, uid, pysyncml.byref(err))
 
         return 1
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]