Skip to content

Commit

Permalink
Tim pointed out that loadEx is supposed to return a 3-tuple. This is …
Browse files Browse the repository at this point in the history
…related to

 collector 1828 which was already marked as resolved.
  • Loading branch information
mcdonc committed Jul 5, 2005
1 parent cefd3d0 commit 12c7332
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
30 changes: 13 additions & 17 deletions TemporaryStorage.py
Expand Up @@ -121,23 +121,19 @@ def load(self, oid, version):
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
Expand Down
10 changes: 10 additions & 0 deletions tests/testTemporaryStorage.py
Expand Up @@ -96,6 +96,16 @@ def checkWithMVCCDoesntRaiseReadConflict(self):
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')
Expand Down

0 comments on commit 12c7332

Please sign in to comment.