[Zodb-checkins] SVN: ZODB/trunk/src/ Merged from 3.9 branch:

Jim Fulton jim at zope.com
Tue Dec 1 16:29:02 EST 2009


Log message for revision 106147:
  Merged from 3.9 branch:
  
  Bug Fixed:
  
  History support was broken when using stprages that work with ZODB
    3.8 and 3.9
  

Changed:
  U   ZODB/trunk/src/CHANGES.txt
  U   ZODB/trunk/src/ZEO/StorageServer.py
  U   ZODB/trunk/src/ZEO/tests/testConversionSupport.py
  U   ZODB/trunk/src/ZODB/scripts/tests.py

-=-
Modified: ZODB/trunk/src/CHANGES.txt
===================================================================
--- ZODB/trunk/src/CHANGES.txt	2009-12-01 21:12:18 UTC (rev 106146)
+++ ZODB/trunk/src/CHANGES.txt	2009-12-01 21:29:01 UTC (rev 106147)
@@ -2,6 +2,16 @@
  Change History
 ================
 
+3.9.4 (2009-12-??)
+==================
+
+Bugs Fixed
+----------
+
+- History support was broken when using stprages that work with ZODB
+  3.8 and 3.9
+
+
 3.9.3 (2009-10-23)
 ==================
 

Modified: ZODB/trunk/src/ZEO/StorageServer.py
===================================================================
--- ZODB/trunk/src/ZEO/StorageServer.py	2009-12-01 21:12:18 UTC (rev 106146)
+++ ZODB/trunk/src/ZEO/StorageServer.py	2009-12-01 21:29:01 UTC (rev 106147)
@@ -188,7 +188,6 @@
             self.undo = undo
 
         self.getTid = storage.getTid
-        self.history = storage.history
         self.load = storage.load
         self.loadSerial = storage.loadSerial
         record_iternext = getattr(storage, 'record_iternext', None)
@@ -220,6 +219,11 @@
             else:
                 raise
 
+    def history(self,tid,size=1):
+        # This caters for storages which still accept
+        # a version parameter.
+        return self.storage.history(tid,size=size)
+
     def _check_tid(self, tid, exc=None):
         if self.read_only:
             raise ReadOnlyError()
@@ -1379,7 +1383,7 @@
     def history(self, oid, version, size=1):
         if version:
             raise ValueError("Versions aren't supported.")
-        return self.storage.history(oid, size)
+        return self.storage.history(oid, size=size)
 
     def getInvalidations(self, tid):
         result = self.storage.getInvalidations(tid)

Modified: ZODB/trunk/src/ZEO/tests/testConversionSupport.py
===================================================================
--- ZODB/trunk/src/ZEO/tests/testConversionSupport.py	2009-12-01 21:12:18 UTC (rev 106146)
+++ ZODB/trunk/src/ZEO/tests/testConversionSupport.py	2009-12-01 21:29:01 UTC (rev 106147)
@@ -91,8 +91,8 @@
 
 The client simply delegates record_iternext calls to it's server stub.
 
-There's really no decent way to test ZEO without running to muc crazy
-stuff.  I'd rather to a lame test than a really lame test, so here goes.
+There's really no decent way to test ZEO without running too much crazy
+stuff.  I'd rather do a lame test than a really lame test, so here goes.
 
 First, fake out the connection manager so we can make a connection:
 
@@ -108,7 +108,7 @@
     >>> client = ClientStorage('', wait=False)
     >>> ClientStorage.ConnectionManagerClass = oldConnectionManagerClass
 
-Now we'll have our way with it's provate _server attr:
+Now we'll have our way with it's private _server attr:
 
     >>> client._server = FakeStorage()
     >>> next = None
@@ -129,8 +129,8 @@
 
 The server stub simply delegates record_iternext calls to it's rpc.
 
-There's really no decent way to test ZEO without running to muc crazy
-stuff.  I'd rather to a lame test than a really lame test, so here goes.
+There's really no decent way to test ZEO without running to much crazy
+stuff.  I'd rather do a lame test than a really lame test, so here goes.
 
     >>> class FauxRPC:
     ...     storage = FakeStorage()
@@ -153,6 +153,41 @@
 
 """
     
+def history_to_version_compatible_storage():
+    """
+    Some storages work under ZODB <= 3.8 and ZODB >= 3.9.
+    This means they have a history method that accepts a version parameter:
+
+    >>> class VersionCompatibleStorage(FakeStorageBase):
+    ...   def history(self,oid,version='',size=1):
+    ...     return oid,version,size
+
+    A ZEOStorage such as the following should support this type of storage:
+    
+    >>> class OurFakeServer(FakeServer):
+    ...   storages = {'1':VersionCompatibleStorage()}
+    >>> import ZEO.StorageServer
+    >>> zeo = ZEO.StorageServer.ZEOStorage(OurFakeServer(), False)
+    >>> zeo.register('1', False)
+
+    The ZEOStorage should sort out the following call such that the storage gets
+    the correct parameters and so should return the parameters it was called with:
+
+    >>> zeo.history('oid',99)
+    ('oid', '', 99)
+
+    The same problem occurs when a Z308 client connects to a Z309 server,
+    but different code is executed:
+
+    >>> from ZEO.StorageServer import ZEOStorage308Adapter
+    >>> zeo = ZEOStorage308Adapter(VersionCompatibleStorage())
+    
+    The history method should still return the parameters it was called with:
+
+    >>> zeo.history('oid','',99)
+    ('oid', '', 99)
+    """
+
 def test_suite():
     return doctest.DocTestSuite()
 

Modified: ZODB/trunk/src/ZODB/scripts/tests.py
===================================================================
--- ZODB/trunk/src/ZODB/scripts/tests.py	2009-12-01 21:12:18 UTC (rev 106146)
+++ ZODB/trunk/src/ZODB/scripts/tests.py	2009-12-01 21:29:01 UTC (rev 106147)
@@ -26,14 +26,8 @@
     (re.compile('hash=[0-9a-f]{40}'),
      'hash=b16422d09fabdb45d4e4325e4b42d7d6f021d3c3')])
 
-class RepozoTests(unittest.TestCase):
-
-    def test_importability(self):
-        from ZODB.scripts import repozo
-
 def test_suite():
     return unittest.TestSuite((
-        unittest.makeSuite(RepozoTests),
         doctest.DocFileSuite(
             'referrers.txt', 'fstail.txt',
             setUp=ZODB.tests.util.setUp, tearDown=ZODB.tests.util.tearDown,



More information about the Zodb-checkins mailing list