Title: [commits] (morgen) [11319] Handle the case where a locally deleted item was modified on the server by letting the repository view merging code it's ok to delete the item.
Revision
11319
Author
morgen
Date
2006-08-03 14:55:28 -0700 (Thu, 03 Aug 2006)

Log Message

Handle the case where a locally deleted item was modified on the server by letting the repository view merging code it's ok to delete the item.

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/sharing/Sharing.py (11318 => 11319)

--- trunk/chandler/parcels/osaf/sharing/Sharing.py	2006-08-03 20:57:59 UTC (rev 11318)
+++ trunk/chandler/parcels/osaf/sharing/Sharing.py	2006-08-03 21:55:28 UTC (rev 11319)
@@ -26,6 +26,7 @@
 from repository.schema.Types import Type
 from repository.util.Lob import Lob
 from chandlerdb.item.ItemError import NoSuchAttributeError
+from repository.persistence.RepositoryError import MergeError
 from PyICU import ICUtzinfo
 import M2Crypto.BIO, WebDAV, twisted.web.http, zanshin.webdav, wx
 from cStringIO import StringIO
@@ -80,6 +81,13 @@
         # 'value' is the one from the *this* view
         # getattr(item, attribute) is the value from a different view
 
+        if code == MergeError.DELETE:
+            logger.debug("Sharing conflict on item %(item)s, "
+                "deleted locally, modified remotely",
+                { 'item' : item, }
+            )
+            return True
+
         logger.debug("Sharing conflict on item %(item)s, attribute "
             "%(attribute)s: %(local)s vs %(remote)s", {
                 'item' : item,
@@ -332,6 +340,11 @@
             metaView.commit(mergeFunction)
 
     except Exception, e:
+
+        # Discard any changes
+        contentView.cancel()
+        metaView.cancel()
+
         logger.exception("Sharing Error: %s" % e)
         raise
 




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to