[Zodb-checkins] CVS: StandaloneZODB/ZODB - FileStorage.py:1.68

Jeremy Hylton jeremy@zope.com
Thu, 4 Oct 2001 18:33:11 -0400


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv12685/ZODB

Modified Files:
	FileStorage.py 
Log Message:
Fix bugs in exception handling for commitVersion().

Replace a string-based exception (a string literal which was broken
even for string-based exceptions) with a class-based exception.

Raise a VersionCommitError is source and dest versions were the same.




=== StandaloneZODB/ZODB/FileStorage.py 1.67 => 1.68 ===
     def commitVersion(self, src, dest, transaction, abort=None):
         # We are going to commit by simply storing back pointers.
-
         if (not src or
             type(src) is not StringType or type(dest) is not StringType
             ):
             raise POSException.VersionCommitError('Invalid source version')
 
+        if src == dest:
+            raise POSException.VersionCommitError(
+                "Can't commit to same version: %s" % repr(src))
+
         if dest and abort:
-            raise 'VersionCommitError', (
-                'Internal error, can\'t abort to a version')
+            raise POSException.VersionCommitError(
+                "Internal error, can't abort to a version")
         
         if transaction is not self._transaction:
             raise POSException.StorageTransactionError(self, transaction)