[Zope3-dev] Usage of actions in zope.formlib ... was: Re: Add flexibility to zope.formlib.form.EditFormBase

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Wed May 9 04:37:14 EDT 2007


> But I have no clever solution for this. My suggestion from the initial
> post (make usage of function applyChanges compatible with subclassing)
> is not a good solution because according to Fred Drake the validator
> should compute the normalized values, so changing things in applyChanges
> is too late. And my suggestion does not allow to use different
> normalizations for different actions in the same class.
> 
> Any ideas?
You can have different validators for different actions. If only
validator function would get 'data' parameter as a dictionary that is
already filled with values (currently it is empty dict) you may simply
normalize values in it. Isn't it a solution for 'normalization' and
specific 'validation' at once? It is also very easy to do it in formlib.
Just change of few lines I think.

If 'validator' isn't a good place for this then another method
can be simply added for preprocessing data before calling real action
handler. This may be better because of proper name of 'new function'
and backward compatibility.


-- 
Maciej Wisniowski


More information about the Zope3-dev mailing list