[Zodb-checkins] CVS: Zope/lib/python/ZODB - POSException.py:1.14

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 5 Sep 2002 06:19:41 -0400


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv13500

Modified Files:
	POSException.py 
Log Message:
added DanglingReferenceError. A new exception for storages to report the fact that a transaction is storing a reference to an object that does not exist. Doing this is 'a bad thing', although it is not entirely clear that it is prohibited. So far only DirectoryStorage makes this check. This is given its own exception class because some code may be able to catch it, and regenerate the object that the storage thinks does not exist.

=== Zope/lib/python/ZODB/POSException.py 1.13 => 1.14 ===
--- Zope/lib/python/ZODB/POSException.py:1.13	Thu Aug 22 10:56:31 2002
+++ Zope/lib/python/ZODB/POSException.py	Thu Sep  5 06:19:40 2002
@@ -104,6 +104,24 @@
     def get_serials(self):
         return self.serials
 
+class DanglingReferenceError(TransactionError):
+    """The transaction stored an object A containing a reference to another
+    object B, but B does not exist
+
+    Instance attributes:
+
+    Aoid: oid of the object being written
+
+    Boid: referenced oid that does not have a corresponding object
+    """
+
+    def __init__(self,Aoid,Boid):
+        self.Aoid = Aoid
+        self.Boid = Boid
+
+    def __str__(self):
+        return "from %r to %r" % (self.Aoid,self.Boid)
+
 
 class ReadConflictError(ConflictError):
     """A conflict was detected at read time.