[Checkins] SVN: z3c.form/trunk/src/z3c/form/ * Provided another
hook in edit forms. Now you can change the behavior
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Jun 22 12:07:26 EDT 2007
Log message for revision 76939:
* Provided another hook in edit forms. Now you can change the behavior
of applying the data without having to rewrite the complete apply
button handler. This turns out to be useful for people not using
objects.
* Updated todos.
Changed:
U z3c.form/trunk/src/z3c/form/TODO.txt
U z3c.form/trunk/src/z3c/form/form.py
-=-
Modified: z3c.form/trunk/src/z3c/form/TODO.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/TODO.txt 2007-06-22 15:51:49 UTC (rev 76938)
+++ z3c.form/trunk/src/z3c/form/TODO.txt 2007-06-22 16:07:26 UTC (rev 76939)
@@ -5,9 +5,6 @@
Framework
---------
-- When an attribute is not accessible, provide a nice error message.
-
-
Documentation
-------------
@@ -19,17 +16,7 @@
- Object name as an additional field in an add form
-- Complex CRUD
- * sub-forms
-
- * custom widgets (date)
-
- * one widget manipulates multiple fields
-
- * Non-ZODB storage
-
-
Improvements
------------
Modified: z3c.form/trunk/src/z3c/form/form.py
===================================================================
--- z3c.form/trunk/src/z3c/form/form.py 2007-06-22 15:51:49 UTC (rev 76938)
+++ z3c.form/trunk/src/z3c/form/form.py 2007-06-22 16:07:26 UTC (rev 76939)
@@ -199,17 +199,22 @@
(self, self.request, self.getContent()), interfaces.IWidgets)
self.widgets.update()
+ def applyChanges(self, data):
+ content = self.getContent()
+ changed = applyChanges(self, content, data)
+ if changed:
+ zope.event.notify(
+ zope.lifecycleevent.ObjectModifiedEvent(content))
+ return changed
+
@button.buttonAndHandler(_('Apply'), name='apply')
def handleApply(self, action):
data, errors = self.widgets.extract()
if errors:
self.status = self.formErrorsMessage
return
- content = self.getContent()
- changed = applyChanges(self, content, data)
+ changed = self.applyChanges(data)
if changed:
- zope.event.notify(
- zope.lifecycleevent.ObjectModifiedEvent(content))
self.status = self.successMessage
else:
self.status = self.noChangesMessage
More information about the Checkins
mailing list