[Commits] (pavlov) fixing cases where it thought the server had changes due to a string compare against a unicode string....

commits at osafoundation.org commits at osafoundation.org
Thu Aug 19 18:18:10 PDT 2004


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

Log message:
fixing cases where it thought the server had changes due to a string compare against a unicode string....
adding deleteResource() method to let you delete files from webdav


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

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

Index: chandler/parcels/osaf/framework/webdav/Sync.py
diff -u chandler/parcels/osaf/framework/webdav/Sync.py:1.8 chandler/parcels/osaf/framework/webdav/Sync.py:1.9
--- chandler/parcels/osaf/framework/webdav/Sync.py:1.8	Thu Aug 19 15:34:42 2004
+++ chandler/parcels/osaf/framework/webdav/Sync.py	Thu Aug 19 18:18:08 2004
@@ -33,6 +33,9 @@
     print '-- needsPut      %s' % (needsPut)
     print '-- localChanges  %s' % (localChanges)
     print '-- serverChanges %s' % (serverChanges)
+    if serverChanges:
+        print '   |-- our etag  %s' % (etag)
+        print '   `-- svr etag  %s' % (dav.etag)
 
     if needsPut:
         dav.putResource(item.itsKind.itsName, 'text/plain')
@@ -94,7 +97,7 @@
 
     for (name, value) in item.iterAttributeValues():
         # don't export these local attributes
-        if name in ['etag', 'lastModified', 'sharedURL']:
+        if name in [u'etag', u'lastModified', u'sharedVersion', u'sharedURL']:
             continue
 
         # the attribute's namespace is its path...
@@ -265,7 +268,7 @@
         # set the version to avoid sync thinking there are local changes
         newItem.sharedVersion = newItem._version
         # set a bogus etag so it doesn't try to put
-        newItem.etag = "12345"
+        newItem.etag = "bad-etag"
 
         # toss this in to the itemMap so we can find it later
         sharing.itemMap[origUUID] = newItem.itsUUID

Index: chandler/parcels/osaf/framework/webdav/Dav.py
diff -u chandler/parcels/osaf/framework/webdav/Dav.py:1.8 chandler/parcels/osaf/framework/webdav/Dav.py:1.9
--- chandler/parcels/osaf/framework/webdav/Dav.py:1.8	Thu Aug 19 13:32:55 2004
+++ chandler/parcels/osaf/framework/webdav/Dav.py	Thu Aug 19 18:18:08 2004
@@ -35,6 +35,9 @@
         return self.newConnection().put(unicode(self.url), body, mimetype, None)
         # return status.. or maybe just throw an exception if the put failed
 
+    def deleteResource(self):
+        return self.newConnection().delete(unicode(self.url))
+
     def getHeaders(self):
         r = self.newConnection().head(unicode(self.url))
         if r.status == 404:
@@ -42,7 +45,7 @@
         return r
 
     def _getETag(self):
-        return self.getHeaders().getheader('ETag', default='')
+        return unicode(self.getHeaders().getheader('ETag', default=''))
 
     def _getLastModified(self):
         return self.getHeaders().getheader('Last-Modified', default='')



More information about the Commits mailing list