[Checkins] SVN: ZODB/trunk/src/ZODB/Connection.py Changed the way version methods are delegated to work with storages

Jim Fulton jim at zope.com
Thu Apr 26 19:19:24 EDT 2007


Log message for revision 74828:
  Changed the way version methods are delegated to work with storages
  that don't provide the methods.
  

Changed:
  U   ZODB/trunk/src/ZODB/Connection.py

-=-
Modified: ZODB/trunk/src/ZODB/Connection.py
===================================================================
--- ZODB/trunk/src/ZODB/Connection.py	2007-04-26 23:19:21 UTC (rev 74827)
+++ ZODB/trunk/src/ZODB/Connection.py	2007-04-26 23:19:23 UTC (rev 74828)
@@ -231,6 +231,9 @@
         if obj is not None:
             return obj
 
+        # This appears to be an MVCC violation because we are loading
+        # the must recent data when perhaps we shouldnt. The key is
+        # that we are only creating a ghost!        
         p, serial = self._storage.load(oid, self._version)
         obj = self._reader.getGhost(p)
 
@@ -1195,11 +1198,19 @@
     def __init__(self, base_version, storage):
         self._storage = storage
         for method in (
-            'getName', 'new_oid', 'modifiedInVersion', 'getSize',
-            'undoLog', 'versionEmpty', 'sortKey', 'loadBefore',
+            'getName', 'new_oid', 'getSize', 'sortKey', 'loadBefore',
             ):
             setattr(self, method, getattr(storage, method))
 
+        try:
+            supportsVersions = storage.supportsVersions
+        except AttributeError:
+            pass
+        else:
+            if supportsVersions():
+                self.modifiedInVersion = storage.modifiedInVersion
+                self.versionEmpty = storage.versionEmpty
+
         self._base_version = base_version
         tmpdir = os.environ.get('ZODB_BLOB_TEMPDIR')
         if tmpdir is None:



More information about the Checkins mailing list