[Zope3-Users] patch for z3c.multiform

Lorenzo Gil Sanchez lgs at sicem.biz
Wed Jul 19 04:34:30 EDT 2006


Attached is a patch to add a small function to z3c.multiform. The 
function is called 'hasChildrenAndAllSubFormsDisplayMode' and is useful 
as a condition for an action.

The use case is this: There is a 'remove' button that deletes lines from 
a multiform form. I don't want this button to show in my form unless the 
container has children.

I hope is useful enough to get in.

Best Regards,


-------------- next part --------------
Index: multiform/multiform.py
--- multiform/multiform.py	(revisión: 69197)
+++ multiform/multiform.py	(copia de trabajo)
@@ -34,6 +34,10 @@
             return False
     return True
+def hasChildrenAndAllSubFormsDisplayMode(form, action):
+    if len(form.context) == 0:
+        return False
+    return allSubFormsDisplayMode(form, action)
 class ItemAction(form.Action):

More information about the Zope3-users mailing list