> 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
Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to