[Zope3-checkins] CVS: Zope3/src/zope/app/services - connection.py:1.20

Bjorn Tillenius bjorn at codeworks.lt
Thu Aug 21 09:01:52 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv17737/src/zope/app/services

Modified Files:
	connection.py 
Log Message:
getConnection and queryConnection should return a connection, not a
database adapter.


=== Zope3/src/zope/app/services/connection.py 1.19 => 1.20 ===
--- Zope3/src/zope/app/services/connection.py:1.19	Tue Aug 19 19:11:05 2003
+++ Zope3/src/zope/app/services/connection.py	Thu Aug 21 08:01:21 2003
@@ -31,13 +31,18 @@
     def getConnection(self, name):
         'See IConnectionService'
         utilities = zapi.getService(self, Utilities)
-        return utilities.getUtility(IZopeDatabaseAdapter, name)
+        dbadapter = utilities.getUtility(IZopeDatabaseAdapter, name)
+        return dbadapter()
     getConnection = zapi.ContextMethod(getConnection)
 
     def queryConnection(self, name, default=None):
         'See IConnectionService'
         utilities = zapi.getService(self, Utilities)
-        return utilities.queryUtility(IZopeDatabaseAdapter, default, name)
+        dbadapter = utilities.queryUtility(IZopeDatabaseAdapter, None, name)
+        if dbadapter:
+            return dbadapter()
+        else:
+            return default
     queryConnection = zapi.ContextMethod(queryConnection)
 
     def getAvailableConnections(self):




More information about the Zope3-Checkins mailing list