[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces - form.py:1.4

Richard Jones richard@commonground.com.au
Sun, 13 Jul 2003 02:47:59 -0400


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

Modified Files:
	form.py 
Log Message:
Implemented Object field types, and ObjectWidget to go with it.
Object fields have Fields on them, and when included in a form view, their
sub-fields fully participate in the form generate and editing. You'd use
this kinda thing for generating an Address field.

The change required the removal of the apply_update method on EditView. It is
replaced by the calling of applyChanges on each widget (facilitated by the 
applyWidgetsChanges function of zope.app.form.utility).

To make this sane, the ObjectWidget must be used via CustomWidget so we can
indicate which factory is to be called to generate the container for the
Object's fields. ObjectWidget and SequenceWidget also allow overriding of
the widgets used to render their sub-fields.

If this is all confusing, then see the new widgets.txt help file in the
zope/app/browser/form/ directory, and it may or may not help :)


=== Zope3/src/zope/app/interfaces/form.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/interfaces/form.py:1.3	Thu May 22 18:49:29 2003
+++ Zope3/src/zope/app/interfaces/form.py	Sun Jul 13 02:47:25 2003
@@ -92,8 +92,8 @@
     def getValue(name):
         """Look up a Widget configuration setting by name."""
 
-    def getData():
-        """Return converted and validated widget data.
+    def validate():
+        """Validate the widget data.
 
         If there is no user input and the field is required, then a
         MissingInputError will be raised.
@@ -104,6 +104,19 @@
         A WidgetInputError is returned in the case of one or more
         errors encountered, inputting, converting, or validating the data.
         """
+
+    def getData():
+        """Return converted and validated widget data.
+
+        See validate() for validation performed.
+        """
+
+    def applyChanges(content):
+        """Validate the widget data and apply it to the content.
+
+        See validate() for validation performed.
+        """
+
 
     def haveData():
         """Is there input data for the field