diff --git a/lib/python/tempstorage/TemporaryStorage.py b/lib/python/tempstorage/TemporaryStorage.py index dbe0a3bb563665f14f0aea5212ef59ce3fa099aa..60b007d63e609cdbc1b1b794ed1d8c11a0cbba07 100644 --- a/lib/python/tempstorage/TemporaryStorage.py +++ b/lib/python/tempstorage/TemporaryStorage.py @@ -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 diff --git a/lib/python/tempstorage/tests/testTemporaryStorage.py b/lib/python/tempstorage/tests/testTemporaryStorage.py index 1a399ee558b54599ba8fb7ab06d3b65f4b1ad4e9..45005a217a056278cc8b90fe4b4557c30dd9d10b 100644 --- a/lib/python/tempstorage/tests/testTemporaryStorage.py +++ b/lib/python/tempstorage/tests/testTemporaryStorage.py @@ -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')