[Zodb-checkins] CVS: Zope3/lib/python/Persistence/BTrees - Exception.py:1.1.2.1 BTreeModuleTemplate.c:1.1.2.6

Jeremy Hylton jeremy@zope.com
Thu, 28 Feb 2002 18:35:39 -0500


Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv7818

Modified Files:
      Tag: Zope-3x-branch
	BTreeModuleTemplate.c 
Added Files:
      Tag: Zope-3x-branch
	Exception.py 
Log Message:
Add Persistence.BTrees.Exception module that defines BTreesConflictError.

This exception class defines some text error messages that explain
what some of the small integers means.  It also means that this BTrees
code can function correctly regardless of whether ZODB on Zope3
matches ZODB on the trunk.


=== Added File Zope3/lib/python/Persistence/BTrees/Exception.py ===
from Transaction.Exceptions 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])
    


=== Zope3/lib/python/Persistence/BTrees/BTreeModuleTemplate.c 1.1.2.5 => 1.1.2.6 ===
 
   /* Grab the ConflictError class */
-  m = PyImport_ImportModule("ZODB.POSException");
+  m = PyImport_ImportModule("Persistence.BTrees.Exception");
   if (m != NULL) {
   	c = PyObject_GetAttrString(m, "BTreesConflictError");
   	if (c != NULL)