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

R. David Murray bitz@bitdance.com
Tue, 24 Dec 2002 10:05:36 -0500


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

Modified Files:
      Tag: NameGeddon-branch
	form.py 
Log Message:
Can't have both a form.py and a form subdirectory and still manage to
import from both, so incorporate what was in the form subdir
(formcollaboration) into form.py.  Looks like it was probably a
mistake in the spec.txt file.


=== Zope3/src/zope/app/interfaces/browser/form.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/interfaces/browser/form.py:1.1.2.2	Mon Dec 23 15:49:37 2002
+++ Zope3/src/zope/app/interfaces/browser/form.py	Tue Dec 24 10:05:35 2002
@@ -14,8 +14,10 @@
 """
 $Id$
 """
+from zope.interface import Interface, Attribute
 from zope.publisher.interfaces.browser import IBrowserView
-from zope.interface import Attribute
+from zope.app.interfaces.forms import IWidget
+
 
 class IReadForm(IBrowserView):
     """This interface defines methods and attributes that are required to
@@ -60,6 +62,7 @@
            into the content object."""
 
 
+
 class IWriteForm(IBrowserView):
     """This interface defines methods and attributes that are required to
     retrieve the data from the request and store them back into the."""
@@ -70,16 +73,11 @@
         to the context object."""
 
 
+
 class IForm(IReadForm, IWriteForm):
     """This is a complete form."""
 
 
-"""
-
-$Id$
-"""
-
-from zope.app.interfaces.forms import IWidget
 
 
 class IBrowserWidget(IWidget):
@@ -106,7 +104,7 @@
     def hidden():
         """Render the widget as a hidden field
         """
-    
+
 
     # XXX The following methods are being supported for backward compatability
     # They are depricated and will be refactored away eventually.
@@ -128,3 +126,34 @@
         """Render the widget as a table row with the label and input widget
         """
         
+
+
+
+class IFormCollaborationView(Interface):
+    """Views that collaborate to create a single form
+
+    When a form is applied, the changes in the form need to
+    be applied to individual views, which update objects as
+    necessary. 
+    """
+
+    def __call__():
+       """Render the view as a part of a larger form.
+
+       Form input elements should be included, prefixed with the
+       prefix given to setPrefix.
+
+       'form' and 'submit' elements should not be included. They
+       will be provided for the larger form.
+       """
+
+    def setPrefix(prefix):
+       """Set the prefix used for names of input elements
+
+       Element names should begin with the given prefix,
+       followed by a dot.
+       """
+
+    def update():
+       """Update the form with data from the request.
+       """