[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Forms/Views/Browser/tests - SchemaTestObject.py:1.4 testConfigure.zcml:1.2 testEditForm.pt:1.2 testFormView.py:1.9

Stephan Richter srichter@cbu.edu
Wed, 17 Jul 2002 14:43:42 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/Forms/Views/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv1727/lib/python/Zope/App/Forms/Views/Browser/tests

Modified Files:
	SchemaTestObject.py testConfigure.zcml testEditForm.pt 
	testFormView.py 
Log Message:
Okay, I finally finished that Schema Demo code. See that 
SchemaTestObject.py file for more info.

You can also see the test page in every folder:
http://localhost:8080/testSchemaFormAction.html


=== Zope3/lib/python/Zope/App/Forms/Views/Browser/tests/SchemaTestObject.py 1.3 => 1.4 ===
                       'creator': CustomWidget(Widget.TextWidget,
                                               displayWidth=30),
                       'data': CustomWidget(Widget.FileWidget)}
+    fields_order = ('id', 'title', 'creator', 'data')
 
 
 def EditFactory(context=None, request=None):


=== Zope3/lib/python/Zope/App/Forms/Views/Browser/tests/testConfigure.zcml 1.1 => 1.2 ===
 <zopeConfigure
    xmlns='http://namespaces.zope.org/zope'
    xmlns:browser='http://namespaces.zope.org/browser'
-   package="Zope.App.Forms.Views.Browser"
 >
 
   <!-- Test view for folders -->
@@ -10,6 +9,7 @@
       for="Zope.App.OFS.Content.Folder.Folder.IFolder."  
       factory=".SchemaTestObject.EditFactory">
       <browser:page name="testSchemaFormView.html" attribute="form" />
+      <browser:page name="testSchemaFormAction.html" attribute="action" />
   </browser:view>
 
 </zopeConfigure>


=== Zope3/lib/python/Zope/App/Forms/Views/Browser/tests/testEditForm.pt 1.1 => 1.2 ===
   </head>
 
   <body>
-    <form action="." method="post">
-   
+
+    <h1>This is a Schema produced form</h1>
+
+    <div tal:condition="python: options.has_key('errors') and 
+                                options['errors']">
+      <span style="font-weight: bold">Errors:</span>
+      <div tal:repeat="error options/errors | nothing">
+        <span tal:replace="python: error[0].title" />: 
+        <span tal:replace="python: error[1].error_name" />
+      </div>
+    </div>
+    <br />
+    <form action="testSchemaFormAction.html" method="post">
+      <input type="hidden" name="nextURL" value=""
+          tal:attributes="value request/URL" />   
       <table>
 
         <tal:block repeat="field view/getFields">
-
           <tr>
             <th tal:content="field/title">Title:</th>
-	    <td tal:content="view/renderField">
+	    <td tal:content="structure python: view.renderField(field)">
               <input size="20" />
             </td>            
           </tr>
-
 	</tal:block>
 
       </table>
  
-      <input type="submit" name="action:method" value="Save" />
+      <input type="submit" name="save" value="Save" />
 
     </form>
   </body>


=== Zope3/lib/python/Zope/App/Forms/Views/Browser/tests/testFormView.py 1.8 => 1.9 ===
         schema = SchemaTestObject.STestObject
         for name in schema.names(1):
             fields.append(schema.getDescriptionFor(name))
-        self.assertEqual(fields, self._form.getFields())
+        fields.sort()
+
+        result = self._form.getFields()
+        result.sort()
+
+        self.assertEqual(fields, result)
 
 
     def _compareWidgets(self, widget1, widget2):