[Checkins] SVN: zope3org/trunk/src/zorg/multiform/

Stefan Martin s.martin at iwm-kmrc.de
Tue Apr 11 05:15:26 EDT 2006


Log message for revision 66837:
  

Changed:
  U   zope3org/trunk/src/zorg/multiform/actions.txt
  U   zope3org/trunk/src/zorg/multiform/multiform.py
  U   zope3org/trunk/src/zorg/multiform/tests.py

-=-
Modified: zope3org/trunk/src/zorg/multiform/actions.txt
===================================================================
--- zope3org/trunk/src/zorg/multiform/actions.txt	2006-04-11 09:09:35 UTC (rev 66836)
+++ zope3org/trunk/src/zorg/multiform/actions.txt	2006-04-11 09:15:25 UTC (rev 66837)
@@ -49,7 +49,8 @@
     ...			
     ...     def template(self):
     ...         return '\n<div>%s</div>\n' % '</div><div>'.join([w() for w in
-    ...     self.widgets])
+    ...     self.widgets] + [action.render() for action in 
+    ...     self.availableActions()])
 
 
     >>> class OrdersForm(MultiFormBase):
@@ -59,6 +60,10 @@
     ...         names = sorted(self.subForms.keys())
     ...         for name in names:
     ...             res += '<div>%s</div>\n' % self.subForms[name].render()
+    ...         for action in self.availableActions():
+    ...             res += '<div>%s</div>\n' % action.render()
+    ...         for action in self.availableSubActions():
+    ...             res += '<div>%s</div>\n' % action.render()
     ...         return res
     ...     
     ...     @form.action('Edit',condition=multiform.isFormDisplayMode)
@@ -78,11 +83,12 @@
     >>> pf = OrdersForm(orderMapping,request)
     >>> print pf()
     <div>
-    <div>0</div><div>n0</div>
+    <div>0</div><div>n0</div>...<input...name="form.n0.actions.upper"...
     </div>
     <div>
-    <div>1</div><div>n1</div>
+    <div>1</div><div>n1</div>...<input...name="form.n1.actions.upper"...
     </div>
+    <div><input...name="form.actions.edit"...</div>
 
 And the save action should not be available, due to the reason that there
 are no input widgets in the sub forms.
@@ -98,11 +104,13 @@
     >>> pf =  OrdersForm(orderMapping,request)
     >>> print pf()
     <div>
-    <div...<input class="textType" ... value="n0" ...
+    <div...<input class="textType" ... value="n0"...
     </div>
     <div>
-    <div...<input class="textType" ... value="n1" ...
-
+    <div...<input class="textType" ... value="n1"...
+    <div><input...name="form.actions.cancel"...</div>
+    <div><input...name="form.actions.save"...</div>
+    
 Now the save action should be available in the subActionNames and
 the cancel action in the multiform actions.
 
@@ -131,11 +139,12 @@
 
     >>> print result
     <div>
-    <div>0</div><div>newer name 0</div>
+    <div>0</div><div>newer name 0</div>...
     </div>
     <div>
-    <div>1</div><div>newer name 1</div>
+    <div>1</div><div>newer name 1</div>...
     </div>
+    ...
 
 Now we should only have the edit action be available, which is a
 multiform action, therefore not contained in the subActionNames
@@ -163,11 +172,11 @@
 
     >>> print result
     <div>
-    <div>0</div><div>newer name 0</div>
+    <div>0</div><div>newer name 0</div>...
     </div>
     <div>
-    <div>1</div><div>newer name 1</div>
-    </div>
+    <div>1</div><div>newer name 1</div>...
+    </div>...
 
 Now let us call the upper action, which should uppercase the name
 attributes of the items. This action is an action on the items itself,
@@ -180,8 +189,8 @@
     >>> result = pf()
     >>> print result
     <div>
-    <div>0</div><div>newer name 0</div>
+    <div>0</div><div>newer name 0</div>...
     </div>
     <div>
-    <div>1</div><div>NEWER NAME 1</div>
-    </div>
+    <div>1</div><div>NEWER NAME 1</div>...
+    </div>...

Modified: zope3org/trunk/src/zorg/multiform/multiform.py
===================================================================
--- zope3org/trunk/src/zorg/multiform/multiform.py	2006-04-11 09:09:35 UTC (rev 66836)
+++ zope3org/trunk/src/zorg/multiform/multiform.py	2006-04-11 09:15:25 UTC (rev 66837)
@@ -143,8 +143,6 @@
     form_fields = []
     actions = []
     subActionNames = []
-    inputMode = None
-    newInputMode = None
     subFormInputMode = {}
     selection = []
     actions = []

Modified: zope3org/trunk/src/zorg/multiform/tests.py
===================================================================
--- zope3org/trunk/src/zorg/multiform/tests.py	2006-04-11 09:09:35 UTC (rev 66836)
+++ zope3org/trunk/src/zorg/multiform/tests.py	2006-04-11 09:15:25 UTC (rev 66837)
@@ -9,7 +9,9 @@
 import zope.app.form.interfaces
 import interfaces
 import gridform
+import multiform
 import selection
+from zope.formlib import form
 
 def setUp(test):
     setup.placefulSetUp()
@@ -73,7 +75,9 @@
                              name="default")
     component.provideAdapter(gridform.default_griditem_template,
                              name="default")
-
+    component.provideAdapter(form.render_submit_button, name='render')
+    component.provideAdapter(multiform.render_submit_button, name='render')
+    
 def tearDown(test):
     setup.placefulTearDown()
 



More information about the Checkins mailing list