[Zope3-checkins] CVS: Zope3/src/zodb - connection.py:1.9 db.py:1.9

Jeremy Hylton jeremy@zope.com
Thu, 27 Feb 2003 15:16:47 -0500


Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv10449

Modified Files:
	connection.py db.py 
Log Message:
Minor change to interface between DB and Connection.

storage is passed to Connection constructor rather than as an
attribute of the database.


=== Zope3/src/zodb/connection.py 1.8 => 1.9 ===
--- Zope3/src/zodb/connection.py:1.8	Tue Feb 11 10:59:27 2003
+++ Zope3/src/zodb/connection.py	Thu Feb 27 15:16:45 2003
@@ -78,9 +78,9 @@
     __implements__ = (IAppConnection, IConnection, IPersistentDataManager,
                       transaction.interfaces.IDataManager)
 
-    def __init__(self, db, version='', cache_size=400):
+    def __init__(self, db, storage, version='', cache_size=400):
         self._db = db
-        self._storage = db._storage
+        self._storage = storage
         self._version = version
         self._cache = cache = Cache(cache_size)
         self._reader = ConnectionObjectReader(self, self._cache)
@@ -524,7 +524,8 @@
         self._file.close()
 
     def getName(self):
-        return self._db.getName()
+        # XXX Is this a useful method?
+        return self._storage.getName()
 
     def getSize(self):
         return self._pos
@@ -546,10 +547,10 @@
     def modifiedInVersion(self, oid):
         if self._index.has_key(oid):
             return self._bver
-        return self._db._storage.modifiedInVersion(oid)
+        return self._storage.modifiedInVersion(oid)
 
     def newObjectId(self):
-        return self._db._storage.newObjectId()
+        return self._storage.newObjectId()
 
     def registerDB(self, db):
         self._db = db


=== Zope3/src/zodb/db.py 1.8 => 1.9 ===
--- Zope3/src/zodb/db.py:1.8	Tue Feb 11 10:59:27 2003
+++ Zope3/src/zodb/db.py	Thu Feb 27 15:16:45 2003
@@ -239,7 +239,8 @@
                 # This is a temporary connection.
                 # We won't bother with the pools.  This will be
                 # a one-use connection.
-                c = Connection(self, version, cache_size=self._cache_size)
+                c = Connection(self, self._storage, version,
+                               cache_size=self._cache_size)
                 self._temps.append(c)
                 if transaction is not None:
                     transaction[id(c)] = c
@@ -259,7 +260,8 @@
                     # size, then we've never reached the limit.
                     # Allocate a connection and return without
                     # touching the lock.
-                    c = Connection(self, version, cache_size=self._cache_size)
+                    c = Connection(self, self._storage, version,
+                                   cache_size=self._cache_size)
                     self._allocated.append(c)
                     return c
                 else: