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

Martijn Faassen m.faassen@vet.uu.nl
Thu, 25 Jul 2002 18:09:32 -0400


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

Modified Files:
	ISQLScript.py SQLScript.py configure.zcml 
Removed Files:
	SSQLScript.py 
Log Message:
Got rid of separate Schema class; just use interfaces now. Updated
Forms and content objects to reflect this change.


=== Zope3/lib/python/Zope/App/OFS/Content/SQLScript/ISQLScript.py 1.2 => 1.3 ===
 """
 from Zope.App.RDB.ISQLCommand import ISQLCommand
 from Interface.Attribute import Attribute
+from Zope.ComponentArchitecture import getService
+from Zope.ContextWrapper import ContextMethod
+import Schema
 
+class SQLConnectionName(Schema.Str):
+    """SQL Connection Name"""
+
+    def items(self):
+        """Note that this method works only if the Field is context wrapped."""
+        connection_service = getService(self, "Connections")
+        connections = connection_service.getAvailableConnections()
+        return connections
+
+    items = ContextMethod(items)
+    
 class ISQLScript(ISQLCommand):
     """A persistent script that can execute SQL."""
 
-    arguments = Attribute('''A set of attributes that can be used during
-                             the DTML rendering process to provide dynamic
-                             data.''')
+    connectionName = SQLConnectionName(
+        id="connectionName",
+        title="Connection Name",
+        description="""The Connection Name for the connection to be used.""",
+        required=1)
+
+    arguments = Schema.Str(
+        id="arguments",
+        title="Arguments",
+        description='A set of attributes that can be used during the DTML '
+                    'rendering process to provide dynamic data.',
+        required=1)
+
+    source = Schema.Str(
+        id="source",
+        title="Source",
+        description="""The source od the page template.""",
+        required=1)
 
     def setArguments(arguments):
         """Processes the arguments (which could be a dict, string or whatever)


=== Zope3/lib/python/Zope/App/OFS/Content/SQLScript/SQLScript.py 1.4 => 1.5 ===
 
 from Zope.App.OFS.Content.IFileContent import IFileContent
 from Zope.App.OFS.Content.SQLScript.ISQLScript import ISQLScript
-from Zope.App.OFS.Content.SQLScript.SSQLScript import SSQLScript
 from Zope.App.OFS.Content.SQLScript.Arguments import parseArguments
 
 from DT_SQLVar import SQLVar
@@ -51,7 +50,7 @@
 
 class SQLScript(SQLCommand, Persistent):
 
-    __implements__ = ISQLScript, SSQLScript, IFileContent
+    __implements__ = ISQLScript, IFileContent
     
     def __init__(self, connectionName='', source='', arguments=''):
         self.template = SQLDTML(source)


=== Zope3/lib/python/Zope/App/OFS/Content/SQLScript/configure.zcml 1.2 => 1.3 ===
         permission="Zope.ManageContent"
         interface=".ISQLScript." />
     <require
-        permission="Zope.View"
-        interface=".SSQLScript." />
-    <require
         permission="Zope.ManageContent"
         interface="Zope.App.OFS.Content.IFileContent." />
   </content>

=== Removed File Zope3/lib/python/Zope/App/OFS/Content/SQLScript/SSQLScript.py ===