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

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


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

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



=== Zope3/src/zope/app/interfaces/content/sql.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/interfaces/content/sql.py:1.10	Wed Dec 17 05:20:48 2003
+++ Zope3/src/zope/app/interfaces/content/sql.py	Fri Dec 19 11:53:16 2003
@@ -15,8 +15,8 @@
 $Id$
 """
 import zope.schema
-
-from zope.app.interfaces.rdb import ISQLCommand
+from zope.app import zapi
+from zope.app.interfaces.rdb import IZopeDatabaseAdapter, ISQLCommand
 from zope.component import getService, ComponentLookupError
 from zope.app.i18n import ZopeMessageIDFactory as _
 
@@ -28,13 +28,16 @@
 
     def __allowed(self):
         """Note that this method works only if the Field is context wrapped."""
+        
         try:
-            connection_service = getService(self.context,
-                                            "SQLDatabaseConnections")
+            connections = zapi.getUtilitiesFor(self.context,
+                                                      IZopeDatabaseAdapter)
+
         except ComponentLookupError:
             return []
 
-        return connection_service.getAvailableConnections()
+        return  [c[0] for c in connections]
+        
 
     allowed_values = property(__allowed)
 
@@ -48,8 +51,9 @@
 
     arguments = zope.schema.BytesLine(
         title=_(u"Arguments"),
-        description=_(u"A set of attributes that can be used during the SQL command "
-                      u"rendering process to provide dynamic data."),
+        description=_(
+        u"A set of attributes that can be used during the SQL command "
+        u"rendering process to provide dynamic data."),
         required=False,
         default='',
         missing_value='')




More information about the Zope3-Checkins mailing list