[Zope3-checkins] CVS: Zope3/src/zope/app/content - sql.py:1.12

Mohan Chandra mchandra at zeomega.com
Fri Dec 19 11:53:46 EST 2003


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

Modified Files:
	sql.py 
Log Message:
Removal of Databaseconnection service 



=== Zope3/src/zope/app/content/sql.py 1.11 => 1.12 ===
--- Zope3/src/zope/app/content/sql.py:1.11	Tue Nov  4 21:46:36 2003
+++ Zope3/src/zope/app/content/sql.py	Fri Dec 19 11:53:15 2003
@@ -159,11 +159,12 @@
 
 from zope.interface import implements
 from zope.component import getService
-
+from zope.app.services.servicenames import Utilities
+from zope.app import zapi
 from zope.app.cache.caching import getCacheForObj, getLocationForCache
 from zope.app.interfaces.content.file import IFileContent
 from zope.app.interfaces.content.sql import ISQLScript, MissingInput
-from zope.app.rdb import SQLCommand
+from zope.app.interfaces.rdb import IZopeDatabaseAdapter
 from zope.app.rdb import queryForResults
 from zope.app.container.contained import Contained
 
@@ -497,7 +498,7 @@
     commands['sqlgroup' ] = SQLGroup
 
 
-class SQLScript(SQLCommand, Persistent, Contained):
+class SQLScript(Persistent, Contained):
 
     implements(ISQLScript, IFileContent)
 
@@ -549,9 +550,9 @@
         return self._connectionName
 
     def getConnection(self):
-        connection_service = getService(self, "SQLDatabaseConnections")
-        connection = connection_service.getConnection(self.connectionName)
-        return connection
+        name = self.connectionName
+        connection = zapi.getUtility(self, IZopeDatabaseAdapter, name)
+        return connection()
 
     # See zope.app.interfaces.content.sql.ISQLScript
     connectionName = property(_getConnectionName, _setConnectionName)




More information about the Zope3-Checkins mailing list