[Zope3-dev] Re: Add flexibility to zope.formlib.form.EditFormBase
Christian Zagrodnick
cz at gocept.com
Mon May 7 02:19:12 EDT 2007
On 2007-05-05 20:07:07 +0200, Marius Gedminas <mgedmin at b4net.lt> said:
>
> On Fri, May 04, 2007 at 09:26:17AM +0200, Michael Howitz wrote:
>> I'm using zope.formlib.form.EditFormBase and want to normalize data =20
>> before saving it.
>> Saving is done by the applyChanges function which is called from =20
>> handle_edit_action.
>> The problem is that handle_edit_action is an action, so I can't =20
>> easily subclass and do a super call to handle_edit_action.
>
> You can, but there's a trick to it---call handle_edit_action.success()
> instead of calling handle_edit_action directly.
Right. I used something like this here in a custom form:
@zope.formlib.form.action(
_("Apply"),
condition=zope.formlib.form.haveInputWidgets)
def handle_edit_action(self, action, data):
super(EditForm, self).handle_edit_action.success(data)
self.request.response.redirect(self.nextURL())
return "Redirect..."
--
Christian Zagrodnick
gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891
More information about the Zope3-dev
mailing list