[Zodb-checkins] SVN: ZODB/branches/3.8/ New Feature:

Jim Fulton jim at zope.com
Tue Dec 15 11:37:35 EST 2009


Log message for revision 106546:
  New Feature:
  
  - The standard storages, FileStorage, ClientStorage, DemoStorage, and
    MappingStorage now allow the version argument to history and load to
    be ommitted.  This is to make it easier to write application code
    that works with ZODB 3.8 and later versions, which don't support
    versions.
  

Changed:
  U   ZODB/branches/3.8/NEWS.txt
  U   ZODB/branches/3.8/src/ZEO/ClientStorage.py
  U   ZODB/branches/3.8/src/ZEO/tests/testZEO.py
  U   ZODB/branches/3.8/src/ZODB/BaseStorage.py
  U   ZODB/branches/3.8/src/ZODB/DemoStorage.py
  U   ZODB/branches/3.8/src/ZODB/FileStorage/FileStorage.py
  U   ZODB/branches/3.8/src/ZODB/MappingStorage.py
  U   ZODB/branches/3.8/src/ZODB/tests/testDemoStorage.py
  U   ZODB/branches/3.8/src/ZODB/tests/testFileStorage.py
  U   ZODB/branches/3.8/src/ZODB/tests/testMappingStorage.py

-=-
Modified: ZODB/branches/3.8/NEWS.txt
===================================================================
--- ZODB/branches/3.8/NEWS.txt	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/NEWS.txt	2009-12-15 16:37:34 UTC (rev 106546)
@@ -1,12 +1,20 @@
 Whats new in ZODB 3.8.5 (2009-12-16)
 ====================================
 
-Bugs Fixed:
+Bug Fixed:
 
 - A ZEO threading bug could cause transactions to read inconsistent
   data.  (This sometimes caused an AssertionError in
   Connection._setstate_noncurrent.)
 
+New Feature:
+
+- The standard storages, FileStorage, ClientStorage, DemoStorage, and
+  MappingStorage now allow the version argument to history and load to
+  be ommitted.  This is to make it easier to write application code
+  that works with ZODB 3.8 and later versions, which don't support
+  versions.
+
 Whats new in ZODB 3.8.4 (2009-10-01)
 ====================================
 

Modified: ZODB/branches/3.8/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZEO/ClientStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZEO/ClientStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -679,7 +679,7 @@
                 self._tbuf.invalidate(oid, "")
         return tid, oids
 
-    def history(self, oid, version, length=1):
+    def history(self, oid, version='', length=1):
         """Storage API: return a sequence of HistoryEntry objects.
 
         This does not support the optional filter argument defined by
@@ -702,7 +702,7 @@
         """Storage API: load a historical revision of an object."""
         return self._server.loadSerial(oid, serial)
 
-    def load(self, oid, version):
+    def load(self, oid, version=''):
         """Storage API: return the data for a given object.
 
         This returns the pickle data and serial number for the object

Modified: ZODB/branches/3.8/src/ZEO/tests/testZEO.py
===================================================================
--- ZODB/branches/3.8/src/ZEO/tests/testZEO.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZEO/tests/testZEO.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -188,6 +188,12 @@
         key = '%s:%s' % (self._storage._storage, self._storage._server_addr)
         self.assertEqual(self._storage.sortKey(), key)
 
+    def checkOmitVersionOnLoadAndHistory(self):
+        db = ZODB.DB(self._storage)
+        self.assertEqual(self._storage.load('\0'*8),
+                         self._storage.load('\0'*8, ''))
+        self._storage.history('\0'*8)
+
 class FullGenericTests(
     GenericTests,
     Cache.StorageWithCache,

Modified: ZODB/branches/3.8/src/ZODB/BaseStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/BaseStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZODB/BaseStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -113,7 +113,7 @@
     def getSize(self):
         return len(self)*300 # WAG!
 
-    def history(self, oid, version, length=1, filter=None):
+    def history(self, oid, version='', length=1, filter=None):
         return ()
 
     def new_oid(self):

Modified: ZODB/branches/3.8/src/ZODB/DemoStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/DemoStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZODB/DemoStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -218,7 +218,7 @@
         finally:
             self._lock_release()
 
-    def load(self, oid, version):
+    def load(self, oid, version=''):
         self._lock_acquire()
         try:
             try:

Modified: ZODB/branches/3.8/src/ZODB/FileStorage/FileStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/FileStorage/FileStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZODB/FileStorage/FileStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -463,7 +463,7 @@
         except TypeError:
             raise TypeError("invalid oid %r" % (oid,))
 
-    def load(self, oid, version):
+    def load(self, oid, version=''):
         """Return pickle data and serial number."""
         self._lock_acquire()
         try:

Modified: ZODB/branches/3.8/src/ZODB/MappingStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/MappingStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZODB/MappingStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -55,7 +55,7 @@
         finally:
             self._lock_release()
 
-    def load(self, oid, version):
+    def load(self, oid, version=''):
         self._lock_acquire()
         try:
             p = self._index[oid]

Modified: ZODB/branches/3.8/src/ZODB/tests/testDemoStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/tests/testDemoStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZODB/tests/testDemoStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -64,7 +64,13 @@
         self.assertEqual(s2.load(ZODB.utils.z64, ''),
                          self._storage.load(ZODB.utils.z64, ''))
 
+    def checkOmitVersionOnLoadAndHistory(self):
+        db = DB(self._storage)
+        self.assertEqual(self._storage.load('\0'*8),
+                         self._storage.load('\0'*8, ''))
+        self._storage.history('\0'*8)
 
+
 class DemoStorageWrappedBase(DemoStorageTests):
 
     def setUp(self):

Modified: ZODB/branches/3.8/src/ZODB/tests/testFileStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/tests/testFileStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZODB/tests/testFileStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -330,6 +330,12 @@
             else:
                 self.assertNotEqual(next_oid, None)
 
+    def checkOmitVersionOnLoadAndHistory(self):
+        db = ZODB.DB(self._storage)
+        self.assertEqual(self._storage.load('\0'*8),
+                         self._storage.load('\0'*8, ''))
+        self._storage.history('\0'*8)
+
 class FileStorageRecoveryTest(
     StorageTestBase.StorageTestBase,
     RecoveryStorage.RecoveryStorage,

Modified: ZODB/branches/3.8/src/ZODB/tests/testMappingStorage.py
===================================================================
--- ZODB/branches/3.8/src/ZODB/tests/testMappingStorage.py	2009-12-15 16:27:04 UTC (rev 106545)
+++ ZODB/branches/3.8/src/ZODB/tests/testMappingStorage.py	2009-12-15 16:37:34 UTC (rev 106546)
@@ -37,6 +37,12 @@
         # have this limit, so we inhibit this test here.
         pass
 
+    def checkOmitVersionOnLoadAndHistory(self):
+        db = ZODB.DB(self._storage)
+        self.assertEqual(self._storage.load('\0'*8),
+                         self._storage.load('\0'*8, ''))
+        self._storage.history('\0'*8)
+
 def test_suite():
     suite = unittest.makeSuite(MappingStorageTests, 'check')
     return suite



More information about the Zodb-checkins mailing list