[Zope3-checkins] CVS: ZODB4/Persistence/BTrees - Interfaces.py:1.13 BTreeModuleTemplate.c:1.15 Exception.py:NONE

Jeremy Hylton jeremy@zope.com
Fri, 20 Dec 2002 14:29:09 -0500


Update of /cvs-repository/ZODB4/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv11012

Modified Files:
	Interfaces.py BTreeModuleTemplate.c 
Removed Files:
	Exception.py 
Log Message:
Move BTreesConflictError to Interfaces.


=== ZODB4/Persistence/BTrees/Interfaces.py 1.12 => 1.13 ===
--- ZODB4/Persistence/BTrees/Interfaces.py:1.12	Fri Nov 29 10:47:59 2002
+++ ZODB4/Persistence/BTrees/Interfaces.py	Fri Dec 20 14:29:08 2002
@@ -11,8 +11,38 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-import OOBTree, Interface, Interface.Standard
-
+import Interface, Interface.Standard
+from Persistence.BTrees import OOBTree
+from Transaction.interfaces import ConflictError
+
+class BTreesConflictError(ConflictError):
+
+    msgs = ['',
+            'Conflicting changes', # in i2 & i3
+            'Conflicting del and change', # in i3 & i2
+            'Conflicting del and change', # in i2 & i3
+            'Conflicting inserts or deletes',
+            'Conflicting deletes',
+            'Conflicting inserts',
+            'Conflicting deletes or delete and change',
+            'Conflicting deletes or delete and change',
+            ]
+
+    def __init__(self, p1, p2, p3, reason):
+        self.p1 = p1
+        self.p2 = p2
+        self.p3 = p3
+        self.reason = reason
+
+    def __repr__(self):
+        return "BTreesConflictError(%d, %d, %d, %d)" % (self.p1,
+                                                        self.p2,
+                                                        self.p3,
+                                                        self.reason)
+    def __str__(self):
+        return "BTrees conflict error at %d/%d/%d: %s" % (
+            self.p1, self.p2, self.p3, self.msgs[self.reason])
+    
 class ICollection(Interface.Interface):
 
     def clear():
@@ -300,7 +330,7 @@
 #
 ################################################################
 
-OOBTree.OOSet.__implements__=ISet
-OOBTree.OOTreeSet.__implements__=ITreeSet
-OOBTree.OOBucket.__implements__=IDictionaryIsh
-OOBTree.OOBTree.__implements__=IBTree
+OOBTree.OOSet.__implements__ = ISet
+OOBTree.OOTreeSet.__implements__ = ITreeSet
+OOBTree.OOBucket.__implements__ = IDictionaryIsh
+OOBTree.OOBTree.__implements__ = IBTree


=== ZODB4/Persistence/BTrees/BTreeModuleTemplate.c 1.14 => 1.15 ===
--- ZODB4/Persistence/BTrees/BTreeModuleTemplate.c:1.14	Thu Oct 10 17:36:17 2002
+++ ZODB4/Persistence/BTrees/BTreeModuleTemplate.c	Fri Dec 20 14:29:08 2002
@@ -421,7 +421,7 @@
 	return;
 
     /* Grab the ConflictError class */
-    m = PyImport_ImportModule("Persistence.BTrees.Exception");
+    m = PyImport_ImportModule("Persistence.BTrees.Interfaces");
     if (m != NULL) {
   	c = PyObject_GetAttrString(m, "BTreesConflictError");
   	if (c != NULL)

=== Removed File ZODB4/Persistence/BTrees/Exception.py ===