[Commits] (pavlov) fixing etag mess for now (weak etags vs strong etags). fixing bug where item collections didn't add their items properly when syncing from the server.

commits at osafoundation.org commits at osafoundation.org
Fri Aug 20 11:20:28 PDT 2004


Commit by: pavlov
Modified files:
chandler/parcels/osaf/framework/webdav/Sync.py 1.9 1.10
chandler/parcels/osaf/framework/webdav/Dav.py 1.9 1.10
chandler/parcels/osaf/framework/webdav/DAVItem.py 1.7 1.8

Log message:
fixing etag mess for now (weak etags vs strong etags).  fixing bug where item collections didn't add their items properly when syncing from the server.


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/webdav/Sync.py.diff?r1=text&tr1=1.9&r2=text&tr2=1.10
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/webdav/Dav.py.diff?r1=text&tr1=1.9&r2=text&tr2=1.10
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/webdav/DAVItem.py.diff?r1=text&tr1=1.7&r2=text&tr2=1.8

Index: chandler/parcels/osaf/framework/webdav/Sync.py
diff -u chandler/parcels/osaf/framework/webdav/Sync.py:1.9 chandler/parcels/osaf/framework/webdav/Sync.py:1.10
--- chandler/parcels/osaf/framework/webdav/Sync.py:1.9	Thu Aug 19 18:18:08 2004
+++ chandler/parcels/osaf/framework/webdav/Sync.py	Fri Aug 20 11:20:26 2004
@@ -21,8 +21,14 @@
 
     etag = item.getAttributeValue('etag', default=None)
     if etag:
+        davETag = dav.etag
         # set serverChanges based on if the etags match
-        serverChanges = (etag != dav.etag)
+        serverChanges = (etag != davETag)
+
+        # I need to understand the difference between strong etags
+        # and weak ones...  for now, pretend they are the same!
+        if serverChanges:
+            serverChanges = (etag != str('W/' + davETag))
     else:
         # this is the first time this item has been shared.
         needsPut = True
@@ -46,10 +52,8 @@
         davItem = DAVItem.DAVItem(dav)
 
         # merge any local changes with server changes
-        try:
-            merge(dav, item, davItem, localChanges)
-        except:
-            pass
+        merge(dav, item, davItem, localChanges)
+
 
     if localChanges:
         # put back merged local changes
@@ -71,7 +75,6 @@
     # for now, just pull changes from the server and overwrite local changes...
     print 'Doing merge'
     item.etag = davItem.etag
-
     syncFromServer(item, davItem)
 
 
@@ -116,7 +119,9 @@
                     DAV(durl).put(i)
                     listData += '<itemref>' + unicode(durl) + '</itemref>'
                 else:
-                    listData += '<value>' + value + '</value>'
+                    #XXX fix this (Value is a PersistentList here??)
+                    #listData += '<value>' + value + '</value>'
+                    pass
             props += makePropString(name, namespace, listData)
 
         elif acard == 'single':
@@ -228,11 +233,11 @@
 
         print 'Merging itemCollection'
         # for now, just sync with whatever the server gave us
-        for i in serverCollections:
+        for i in serverCollectionResults:
             if i not in item:
                 item.add(i)
         for i in item:
-            if i not in serverCollections:
+            if i not in serverCollectionResults:
                 item.remove(i)
     #
     # End refactor

Index: chandler/parcels/osaf/framework/webdav/Dav.py
diff -u chandler/parcels/osaf/framework/webdav/Dav.py:1.9 chandler/parcels/osaf/framework/webdav/Dav.py:1.10
--- chandler/parcels/osaf/framework/webdav/Dav.py:1.9	Thu Aug 19 18:18:08 2004
+++ chandler/parcels/osaf/framework/webdav/Dav.py	Fri Aug 20 11:20:27 2004
@@ -45,7 +45,7 @@
         return r
 
     def _getETag(self):
-        return unicode(self.getHeaders().getheader('ETag', default=''))
+        return self.getHeaders().getheader('ETag', default='')
 
     def _getLastModified(self):
         return self.getHeaders().getheader('Last-Modified', default='')

Index: chandler/parcels/osaf/framework/webdav/DAVItem.py
diff -u chandler/parcels/osaf/framework/webdav/DAVItem.py:1.7 chandler/parcels/osaf/framework/webdav/DAVItem.py:1.8
--- chandler/parcels/osaf/framework/webdav/DAVItem.py:1.7	Thu Aug 19 18:18:08 2004
+++ chandler/parcels/osaf/framework/webdav/DAVItem.py	Fri Aug 20 11:20:27 2004
@@ -68,7 +68,7 @@
         return UUID(value)
 
     def _getETag(self):
-        return unicode(self._getAttribute('getetag', 'DAV:'))
+        return self._getAttribute('getetag', 'DAV:')
 
     def _getLastModified(self):
         return self._getAttribute('getlastmodified', 'DAV:')



More information about the Commits mailing list