Commit cdb94c28 authored by Jim Fulton's avatar Jim Fulton

New Feature:

- The standard storages, FileStorage, ClientStorage, DemoStorage, and
  MappingStorage now allow the version argument to history and load to
  be ommitted.  This is to make it easier to write application code
  that works with ZODB 3.8 and later versions, which don't support
  versions.
parent 3550df2a
Whats new in ZODB 3.8.5 (2009-12-16)
====================================
Bugs Fixed:
Bug Fixed:
- A ZEO threading bug could cause transactions to read inconsistent
data. (This sometimes caused an AssertionError in
Connection._setstate_noncurrent.)
New Feature:
- The standard storages, FileStorage, ClientStorage, DemoStorage, and
MappingStorage now allow the version argument to history and load to
be ommitted. This is to make it easier to write application code
that works with ZODB 3.8 and later versions, which don't support
versions.
Whats new in ZODB 3.8.4 (2009-10-01)
====================================
......
......@@ -679,7 +679,7 @@ class ClientStorage(object):
self._tbuf.invalidate(oid, "")
return tid, oids
def history(self, oid, version, length=1):
def history(self, oid, version='', length=1):
"""Storage API: return a sequence of HistoryEntry objects.
This does not support the optional filter argument defined by
......@@ -702,7 +702,7 @@ class ClientStorage(object):
"""Storage API: load a historical revision of an object."""
return self._server.loadSerial(oid, serial)
def load(self, oid, version):
def load(self, oid, version=''):
"""Storage API: return the data for a given object.
This returns the pickle data and serial number for the object
......
......@@ -188,6 +188,12 @@ class GenericTests(
key = '%s:%s' % (self._storage._storage, self._storage._server_addr)
self.assertEqual(self._storage.sortKey(), key)
def checkOmitVersionOnLoadAndHistory(self):
db = ZODB.DB(self._storage)
self.assertEqual(self._storage.load('\0'*8),
self._storage.load('\0'*8, ''))
self._storage.history('\0'*8)
class FullGenericTests(
GenericTests,
Cache.StorageWithCache,
......
......@@ -113,7 +113,7 @@ class BaseStorage(UndoLogCompatible):
def getSize(self):
return len(self)*300 # WAG!
def history(self, oid, version, length=1, filter=None):
def history(self, oid, version='', length=1, filter=None):
return ()
def new_oid(self):
......
......@@ -218,7 +218,7 @@ class DemoStorage(BaseStorage):
finally:
self._lock_release()
def load(self, oid, version):
def load(self, oid, version=''):
self._lock_acquire()
try:
try:
......
......@@ -463,7 +463,7 @@ class FileStorage(BaseStorage.BaseStorage,
except TypeError:
raise TypeError("invalid oid %r" % (oid,))
def load(self, oid, version):
def load(self, oid, version=''):
"""Return pickle data and serial number."""
self._lock_acquire()
try:
......
......@@ -55,7 +55,7 @@ class MappingStorage(BaseStorage):
finally:
self._lock_release()
def load(self, oid, version):
def load(self, oid, version=''):
self._lock_acquire()
try:
p = self._index[oid]
......
......@@ -64,6 +64,12 @@ class DemoStorageTests(StorageTestBase.StorageTestBase,
self.assertEqual(s2.load(ZODB.utils.z64, ''),
self._storage.load(ZODB.utils.z64, ''))
def checkOmitVersionOnLoadAndHistory(self):
db = DB(self._storage)
self.assertEqual(self._storage.load('\0'*8),
self._storage.load('\0'*8, ''))
self._storage.history('\0'*8)
class DemoStorageWrappedBase(DemoStorageTests):
......
......@@ -330,6 +330,12 @@ class FileStorageTests(
else:
self.assertNotEqual(next_oid, None)
def checkOmitVersionOnLoadAndHistory(self):
db = ZODB.DB(self._storage)
self.assertEqual(self._storage.load('\0'*8),
self._storage.load('\0'*8, ''))
self._storage.history('\0'*8)
class FileStorageRecoveryTest(
StorageTestBase.StorageTestBase,
RecoveryStorage.RecoveryStorage,
......
......@@ -37,6 +37,12 @@ class MappingStorageTests(StorageTestBase.StorageTestBase,
# have this limit, so we inhibit this test here.
pass
def checkOmitVersionOnLoadAndHistory(self):
db = ZODB.DB(self._storage)
self.assertEqual(self._storage.load('\0'*8),
self._storage.load('\0'*8, ''))
self._storage.history('\0'*8)
def test_suite():
suite = unittest.makeSuite(MappingStorageTests, 'check')
return suite
......
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