[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/tempstorage/ Tim pointed out that loadEx is supposed to return a 3-tuple. This is related to

Chris McDonough chrism at plope.com
Tue Jul 5 15:41:40 EDT 2005


Log message for revision 31015:
  Tim pointed out that loadEx is supposed to return a 3-tuple.  This is related to
   collector 1828 which was already marked as resolved.
  
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/tempstorage/TemporaryStorage.py
  U   Zope/branches/Zope-2_8-branch/lib/python/tempstorage/tests/testTemporaryStorage.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/tempstorage/TemporaryStorage.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/tempstorage/TemporaryStorage.py	2005-07-05 19:39:45 UTC (rev 31014)
+++ Zope/branches/Zope-2_8-branch/lib/python/tempstorage/TemporaryStorage.py	2005-07-05 19:41:40 UTC (rev 31015)
@@ -121,23 +121,19 @@
             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
+    # 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
 
-    loadEx = load
+    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

Modified: Zope/branches/Zope-2_8-branch/lib/python/tempstorage/tests/testTemporaryStorage.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/tempstorage/tests/testTemporaryStorage.py	2005-07-05 19:39:45 UTC (rev 31014)
+++ Zope/branches/Zope-2_8-branch/lib/python/tempstorage/tests/testTemporaryStorage.py	2005-07-05 19:41:40 UTC (rev 31015)
@@ -96,6 +96,16 @@
         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')



More information about the Zope-Checkins mailing list