Commit c487d240 authored by Chris McDonough's avatar Chris McDonough

Tim pointed out that loadEx is supposed to return a 3-tuple. This is related...

Tim pointed out that loadEx is supposed to return a 3-tuple.  This is related to collector 1828 which was already marked as resolved.
parent c6121d96
......@@ -121,23 +121,19 @@ class TemporaryStorage(BaseStorage, ConflictResolvingStorage):
self._lock_release()
# Apparently loadEx is required to use this as a ZEO storage for
# ZODB 3.3. There are no docs for loadEx, and the tests don't
# make it totally clear what it's meant to do. In MappingStorage,
# it has the same argument signature and returns the same thing
# that load does, so we do the same here. There is a comment in
# FileStorage about its loadEx method implementation that says "a
# variant of load that also returns a transaction id. ZEO wants
# this for managing its cache". But 'load' appears to do that
# too, so uh, who knows. Apparently it also has something to do
# with the ZODB iteration interface, because it's tested within
# the IteratorStorage tests, although we don't need to support the
# iterator interface for ZEO to work, so we don't. MVCC, despite
# descriptions to the contrary on the Wiki doesn't actually need
# the iterator interface either. Just doing my duty to promote
# the lost art of voodoo programming here, there's no need to
# thank me! - CM
loadEx = load
# ZODB 3.3. The tests don't make it totally clear what it's meant
# to do. There is a comment in FileStorage about its loadEx
# method implementation that says "a variant of load that also
# returns a transaction id. ZEO wants this for managing its
# cache". But 'load' appears to do that too, so uh, who knows.
# - CM
def loadEx(self, oid, version):
data = self.load(oid, version)
# pickle, serial, version
# return an empty string for the version, as this is not a
# versioning storage, and it's what MappingStorage does.
return (data[0], data[1], "")
def loadSerial(self, oid, serial, marker=[]):
""" this is only useful to make conflict resolution work. It
......
......@@ -96,6 +96,16 @@ class TemporaryStorageTests(
self.assertEquals(getattr(ob, 'child1', MinPO()).value, 'child1')
self.failIf(getattr(ob, 'child2', None))
def checkLoadEx(self):
oid = self._storage.new_oid()
self._dostore(oid, data=MinPO(1))
loadp, loads = self._storage.load(oid, 'whatever')
exp, exs, exv = self._storage.loadEx(oid, 'whatever')
self.assertEqual(loadp, exp)
self.assertEqual(loads, exs)
self.assertEqual(exv, '')
def test_suite():
suite = unittest.makeSuite(TemporaryStorageTests, 'check')
suite2 = unittest.makeSuite(Corruption.FileStorageCorruptTests, 'check')
......
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