[Checkins] SVN: zope3org/trunk/src/zorg/multiform/ cosmetics
Bernd Dorn
bernd.dorn at fhv.at
Sun Apr 9 16:54:42 EDT 2006
Log message for revision 66752:
cosmetics
Changed:
U zope3org/trunk/src/zorg/multiform/actions.txt
U zope3org/trunk/src/zorg/multiform/multiform.py
-=-
Modified: zope3org/trunk/src/zorg/multiform/actions.txt
===================================================================
--- zope3org/trunk/src/zorg/multiform/actions.txt 2006-04-09 20:38:50 UTC (rev 66751)
+++ zope3org/trunk/src/zorg/multiform/actions.txt 2006-04-09 20:54:41 UTC (rev 66752)
@@ -29,37 +29,6 @@
>>> orderMapping = dict([(str(k),Order(k,name='n%s'%k)) for k in range(2)])
- >>> def isFormDisplayMode(f,action):
- ... return not f.inputMode
-
- >>> def isFormInputMode(f,action):
- ... return f.inputMode
-
- >>> def isParentFormInputMode(f,action):
- ... return f.parentForm.inputMode
-
- >>> def hasInputWidgets(f,action):
- ... if form.haveInputWidgets(f,action):
- ... return True
- ... if ISubmittedAction.providedBy(action):
- ... tmpForm = f.parentForm.itemFormFactory(f.context,
- ... f.request,f.parentForm)
- ... tmpForm.setPrefix(f.prefix)
- ... hasInput = True
- ... form_prefix = f.prefix +'.'
- ... for field in tmpForm.form_fields:
- ... field.for_display=False
- ... tmpForm.setUpWidgets()
- ... for input, widget in \
- ... tmpForm.widgets.__iter_input_and_widget__():
- ... if input and IInputWidget.providedBy(widget):
- ... name = form._widgetKey(widget, form_prefix)
- ... if not widget.hasInput():
- ... hasInput = False
- ... break
- ... return hasInput
- ... return False
-
>>> class OrderForm(ItemFormBase):
... inputMode=False
...
@@ -68,14 +37,13 @@
... self.form_fields = form.Fields(IOrder,omit_readonly=False,
... render_context=True)
...
- ... @multiform.parentAction(u"Save",condition=isParentFormInputMode,
- ... inputMode=True)
+ ... @multiform.parentAction(u"Save",
+ ... condition=multiform.isParentFormInputMode,inputMode=True)
... def handle_save_action(self, action, data):
... form.applyChanges(self.context, self.form_fields,
... data, self.adapters)
... self.parentForm.newInputMode=False
...
- ...
... def template(self):
... return '\n<div>%s</div>\n' % '</div><div>'.join([w() for w in
... self.widgets])
@@ -90,11 +58,11 @@
... res += '<div>%s</div>\n' % self.subForms[name].render()
... return res
...
- ... @form.action('Edit',condition=isFormDisplayMode)
+ ... @form.action('Edit',condition=multiform.isFormDisplayMode)
... def handle_edit_action(self, action, data):
... self.newInputMode=True
...
- ... @form.action('Cancel',condition=isFormInputMode)
+ ... @form.action('Cancel',condition=multiform.isFormInputMode)
... def handle_cancel_action(self, action, data):
... self.newInputMode=False
Modified: zope3org/trunk/src/zorg/multiform/multiform.py
===================================================================
--- zope3org/trunk/src/zorg/multiform/multiform.py 2006-04-09 20:38:50 UTC (rev 66751)
+++ zope3org/trunk/src/zorg/multiform/multiform.py 2006-04-09 20:54:41 UTC (rev 66752)
@@ -10,6 +10,17 @@
from zope import interface
+def isFormDisplayMode(f,action):
+ return not f.inputMode
+
+def isFormInputMode(f,action):
+ return f.inputMode
+
+def isParentFormInputMode(f,action):
+ return f.parentForm.inputMode
+
+
+
class ParentAction(form.Action):
"""an action that is rendered in the parent multiform object and
More information about the Checkins
mailing list