Darryl Cousins wrote:
On Thu, 2007-03-29 at 05:52 -0400, Fred Drake wrote:
On 3/29/07, Darryl Cousins <[EMAIL PROTECTED]> wrote:
but the line previous says

  data = {}

So my validator always receives an empty dictionary to validate.
The validator is responsible for populating `data` with the valid
values.  That's definitely covered in the docs somewhere.


Cheers for the reply Fred. Indeed form.txt in formlib does say:

If the validator is provided as a method name, the method  will be
called with the action and a dictionary in which to save data.

Then the assumption is that the custom validator method will get the
submitted values from the form object (also passed to the method along
with the action and `empty` dictionary, though that isn't mentioned in
form.txt). I'm thinking that the use-case for this functionality has
been lost in development; historical flotsam. Who, after all, needs an
empty dictionary passed to a method? And the method is expected to
return <quote form.txt> a (usually empty) list of widget input errors.
So what is the point of having an empty dict to populate?

`data` itself is not returned, nor available outside the method, so your
answer "with the valid values" makes little sense to me. But maybe I'm
missing something?

You are. The validator is not given just *any* empty dictionary, it is given the data dictionary that will later be passed to the action.

http://worldcookery.com -- Professional Zope documentation and training
Zope3-users mailing list

Reply via email to