Commit e354e393 authored by Barry Warsaw's avatar Barry Warsaw

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".
parent 47fc3143
...@@ -84,11 +84,13 @@ ...@@ -84,11 +84,13 @@
############################################################################## ##############################################################################
"""Handy standard storage machinery """Handy standard storage machinery
""" """
__version__='$Revision: 1.11 $'[11:-2] # Do this portably in the face of checking out with -kv
import string
__version__ = string.split('$Revision: 1.12 $')[-2:][0]
import ThreadLock, bpthread import ThreadLock, bpthread
import time, UndoLogCompatible import time, UndoLogCompatible
from POSException import UndoError import POSException
from TimeStamp import TimeStamp from TimeStamp import TimeStamp
z64='\0'*8 z64='\0'*8
...@@ -120,9 +122,12 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -120,9 +122,12 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
raise POSException.StorageTransactionError(self, transaction) raise POSException.StorageTransactionError(self, transaction)
return [] 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 getName(self): return self.__name__
def getSize(self): return len(self)*300 # WAG! def getSize(self): return len(self)*300 # WAG!
...@@ -224,7 +229,7 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible): ...@@ -224,7 +229,7 @@ class BaseStorage(UndoLogCompatible.UndoLogCompatible):
pass pass
def undo(self, transaction_id): def undo(self, transaction_id):
raise UndoError, 'non-undoable transaction' raise POSException.UndoError, 'non-undoable transaction'
def undoLog(self, first, last, filter=None): return () def undoLog(self, first, last, filter=None): return ()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment