[Zope-Checkins] CVS: Zope2 - BaseStorage.py:1.12
barry@digicool.com
barry@digicool.com
Tue, 3 Apr 2001 14:08:54 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/ZODB
In directory korak:/tmp/cvs-serv8429
Modified Files:
BaseStorage.py
Log Message:
Fixing two small bugs uncovered by unit testing (I was testing the
Minimal BSDDB storage which does not override abortVersion() and
commitVersion()).
commitVersion() can't be an alias for abortVersion() because it takes
a different number of arguments. Provide a simple implementation.
Changed "from POSException import UndoError" to "import POSException"
and use POSException.UndoError in undo(). This is because
abortVersion() and commitVersion() also reference exceptions in the
POSException module.
Aside: fix __version__ extraction from $Revision$ to be portable in
the face of "cvs co -kv".
--- Updated File BaseStorage.py in package Zope2/lib/python/ZODB --
--- BaseStorage.py 2001/03/15 13:16:26 1.11
+++ BaseStorage.py 2001/04/03 18:08:51 1.12
@@ -84,11 +84,13 @@
##############################################################################
"""Handy standard storage machinery
"""
-__version__='$Revision$'[11:-2]
+# Do this portably in the face of checking out with -kv
+import string
+__version__ = string.split('$Revision$')[-2:][0]
import ThreadLock, bpthread
import time, UndoLogCompatible
-from POSException import UndoError
+import POSException
from TimeStamp import TimeStamp
z64='\0'*8
@@ -120,9 +122,12 @@
raise POSException.StorageTransactionError(self, transaction)
return []
- def close(self): pass
+ def commitVersion(self, src, dest, transaction):
+ if transaction is not self._transaction:
+ raise POSException.StorageTransactionError(self, transaction)
+ return []
- commitVersion=abortVersion
+ def close(self): pass
def getName(self): return self.__name__
def getSize(self): return len(self)*300 # WAG!
@@ -224,7 +229,7 @@
pass
def undo(self, transaction_id):
- raise UndoError, 'non-undoable transaction'
+ raise POSException.UndoError, 'non-undoable transaction'
def undoLog(self, first, last, filter=None): return ()
--- Updated File BaseStorage.py in package Zope2 --
--- BaseStorage.py 2001/03/15 13:16:26 1.11
+++ BaseStorage.py 2001/04/03 18:08:51 1.12
@@ -84,11 +84,13 @@
##############################################################################
"""Handy standard storage machinery
"""
-__version__='$Revision$'[11:-2]
+# Do this portably in the face of checking out with -kv
+import string
+__version__ = string.split('$Revision$')[-2:][0]
import ThreadLock, bpthread
import time, UndoLogCompatible
-from POSException import UndoError
+import POSException
from TimeStamp import TimeStamp
z64='\0'*8
@@ -120,9 +122,12 @@
raise POSException.StorageTransactionError(self, transaction)
return []
- def close(self): pass
+ def commitVersion(self, src, dest, transaction):
+ if transaction is not self._transaction:
+ raise POSException.StorageTransactionError(self, transaction)
+ return []
- commitVersion=abortVersion
+ def close(self): pass
def getName(self): return self.__name__
def getSize(self): return len(self)*300 # WAG!
@@ -224,7 +229,7 @@
pass
def undo(self, transaction_id):
- raise UndoError, 'non-undoable transaction'
+ raise POSException.UndoError, 'non-undoable transaction'
def undoLog(self, first, last, filter=None): return ()