[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/SQLScript - ISQLScript.py:1.13 configure.zcml:1.5

Jim Fulton jim@zope.com
Mon, 11 Nov 2002 16:10:36 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/SQLScript
In directory cvs.zope.org:/tmp/cvs-serv22839

Modified Files:
	ISQLScript.py configure.zcml 
Log Message:
Changed the ConnectionName field type to provide allowed_values rather
than items. Changed the editing view to use an automatically generated
view.



=== Zope3/lib/python/Zope/App/OFS/Content/SQLScript/ISQLScript.py 1.12 => 1.13 ===
--- Zope3/lib/python/Zope/App/OFS/Content/SQLScript/ISQLScript.py:1.12	Thu Oct 10 04:57:37 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/SQLScript/ISQLScript.py	Mon Nov 11 16:10:35 2002
@@ -17,19 +17,19 @@
 from Zope.App.RDB.ISQLCommand import ISQLCommand
 from Interface.Attribute import Attribute
 from Zope.ComponentArchitecture import getService
-from Zope.ContextWrapper import ContextMethod
+from Zope.ContextWrapper import ContextProperty
 import Zope.Schema
 
-class SQLConnectionName(Zope.Schema.Text):
+class SQLConnectionName(Zope.Schema.TextLine):
     """SQL Connection Name"""
 
-    def items(self):
+    def __allowed(self):
         """Note that this method works only if the Field is context wrapped."""
-        connection_service = getService(self, "Connections")
+        connection_service = getService(self.context, "Connections")
         connections = connection_service.getAvailableConnections()
         return connections
 
-    items = ContextMethod(items)
+    allowed_values = ContextProperty(__allowed)
 
 class ISQLScript(ISQLCommand):
     """A persistent script that can execute SQL."""
@@ -37,9 +37,9 @@
     connectionName = SQLConnectionName(
         title=u"Connection Name",
         description=u"The Connection Name for the connection to be used.",
-        required=True)
+        required=False)
 
-    arguments = Zope.Schema.Bytes(
+    arguments = Zope.Schema.Line(
         title=u"Arguments",
         description=u"A set of attributes that can be used during the DTML "
                     u"rendering process to provide dynamic data.",


=== Zope3/lib/python/Zope/App/OFS/Content/SQLScript/configure.zcml 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/App/OFS/Content/SQLScript/configure.zcml:1.4	Fri Oct  4 16:02:03 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/SQLScript/configure.zcml	Mon Nov 11 16:10:35 2002
@@ -13,8 +13,10 @@
         description="Dynamic SQL Script" />
 
     <require
-        permission="Zope.ManageContent"
-        interface=".ISQLScript." />
+        permission = "Zope.ManageContent"
+        interface = ".ISQLScript."
+        set_schema = ".ISQLScript."
+        />
 
     <require
         permission="Zope.ManageContent"