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