[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/ Fixed a bug in loadEx that caused it to return incorrect values when

Jim Fulton jim at zope.com
Wed Apr 25 13:48:03 EDT 2007


Log message for revision 74758:
  Fixed a bug in loadEx that caused it to return incorrect values when
  delegating to the base storage.
  
  Added a cleanup method that delegates to the base storage.
  

Changed:
  U   ZODB/trunk/src/ZODB/DemoStorage.py
  U   ZODB/trunk/src/ZODB/tests/testDemoStorage.py

-=-
Modified: ZODB/trunk/src/ZODB/DemoStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/DemoStorage.py	2007-04-25 13:34:07 UTC (rev 74757)
+++ ZODB/trunk/src/ZODB/DemoStorage.py	2007-04-25 17:48:02 UTC (rev 74758)
@@ -219,7 +219,7 @@
                 oid, pre, vdata, p, tid = self._index[oid]
             except KeyError:
                 if self._base:
-                    return self._base.load(oid, '')
+                    return self._base.loadEx(oid, version)
                 raise KeyError(oid)
 
             ver = ""
@@ -560,3 +560,7 @@
                 o.append('    %s: %s' % (oid_repr(oid), r))
 
         return '\n'.join(o)
+
+    def cleanup(self):
+        if self._base is not None:
+            self._base.cleanup()

Modified: ZODB/trunk/src/ZODB/tests/testDemoStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/testDemoStorage.py	2007-04-25 13:34:07 UTC (rev 74757)
+++ ZODB/trunk/src/ZODB/tests/testDemoStorage.py	2007-04-25 17:48:02 UTC (rev 74758)
@@ -13,8 +13,12 @@
 ##############################################################################
 import unittest
 
-from ZODB.tests import StorageTestBase, BasicStorage, \
-     VersionStorage, Synchronization
+import transaction
+from ZODB.DB import DB
+import ZODB.utils
+import ZODB.DemoStorage
+from ZODB.tests import StorageTestBase, BasicStorage, VersionStorage
+from ZODB.tests import Synchronization
 
 class DemoStorageTests(StorageTestBase.StorageTestBase,
                        BasicStorage.BasicStorage,
@@ -23,7 +27,6 @@
                        ):
 
     def setUp(self):
-        import ZODB.DemoStorage
         self._storage = ZODB.DemoStorage.DemoStorage()
 
     def tearDown(self):
@@ -54,7 +57,14 @@
     def checkPackVersionsInPast(self):
         pass
 
+    def checkLoadExDelegation(self):
+        # Minimal test of loadEX w/o version -- ironically
+        db = DB(self._storage) # creates object 0. :)
+        s2 = ZODB.DemoStorage.DemoStorage(base=self._storage)
+        self.assertEqual(s2.loadEx(ZODB.utils.z64, ''),
+                         self._storage.loadEx(ZODB.utils.z64, ''))
 
+
 class DemoStorageWrappedBase(DemoStorageTests):
 
     def setUp(self):



More information about the Zodb-checkins mailing list