[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/ Fixed a bug in basic multi-database support. get_connection needs to

Jim Fulton jim at zope.com
Thu Jun 16 06:56:54 EDT 2005


Log message for revision 30809:
  Fixed a bug in basic multi-database support.  get_connection needs to
  pass optional open arguments to secondary databases.
  

Changed:
  U   ZODB/trunk/src/ZODB/Connection.py
  U   ZODB/trunk/src/ZODB/tests/multidb.txt

-=-
Modified: ZODB/trunk/src/ZODB/Connection.py
===================================================================
--- ZODB/trunk/src/ZODB/Connection.py	2005-06-16 09:55:48 UTC (rev 30808)
+++ ZODB/trunk/src/ZODB/Connection.py	2005-06-16 10:56:53 UTC (rev 30809)
@@ -300,7 +300,10 @@
         """Return a Connection for the named database."""
         connection = self.connections.get(database_name)
         if connection is None:
-            new_con = self._db.databases[database_name].open()
+            new_con = self._db.databases[database_name].open(
+                transaction_manager=self.transaction_manager,
+                mvcc=self._mvcc, version=self._version, synch=self._synch,
+                )
             self.connections.update(new_con.connections)
             new_con.connections = self.connections
             connection = new_con

Modified: ZODB/trunk/src/ZODB/tests/multidb.txt
===================================================================
--- ZODB/trunk/src/ZODB/tests/multidb.txt	2005-06-16 09:55:48 UTC (rev 30808)
+++ ZODB/trunk/src/ZODB/tests/multidb.txt	2005-06-16 10:56:53 UTC (rev 30809)
@@ -94,7 +94,9 @@
 
 You can (still) get a connection to a database this way:
 
-    >>> cn = db.open()
+    >>> import transaction
+    >>> tm = transaction.TransactionManager()
+    >>> cn = db.open(transaction_manager=tm)
     >>> cn                  # doctest: +ELLIPSIS
     <Connection at ...>
 
@@ -111,6 +113,11 @@
     >>> cn2                  # doctest: +ELLIPSIS
     <Connection at ...>
 
+The second connection gets the same transaction manager as the first:
+
+    >>> cn2.transaction_manager is tm
+    True
+
 Now there are two connections in that collection:
 
     >>> cn2.connections is cn.connections



More information about the Zodb-checkins mailing list