Am 04.05.2007 um 10:28 schrieb Maciej Wisniowski:
[...]
What code you have to copy-paste from formlib when you add your own
handle_edit_action?
I think it is common to do something like:

from zope.formlib import form
form.applyChanges(...)

The method EditFormBase.handle_edit_action contains code to set the status message which I have to copy-paste when I want to use it unchanged.

My solution would be to add an applyChanges method to
zope.formlib.form.EditFormBase which calls the applyChanges function.
Any objections?
Possibly a lot of existing code uses form.applyChanges as in example
above so this may be a compatibility problem.

No, my suggestion does not break any existing code because it only adds a new method to EditFormBase which gets called from handle_edit_action instead of the function. This new method then calls the applyChanges function. So you are able to overwrite the new method in a subclass to normalize before applying.

[...]
For me it would be better to change handleSubmit method
and the way action.validate is called there.
[...]
This way validate gets 'data' parameter that already has
values from widgets, these values may be simply validated and/or
normalized. There is even no need to change edit action.

-1
A method called "validate" should only tell valid or not (and why) but it should not change the data.

Yours sincerely,
Michael Howitz

gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon: +49 345 12298898 · fax: +49 345 12298891


_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to