[Zope3-Users] Formlib - handleSubmit, custom validator on action
Darryl Cousins
darryl at darrylcousins.net.nz
Thu Mar 29 08:37:18 EDT 2007
Hi,
On Thu, 2007-03-29 at 05:52 -0400, Fred Drake wrote:
> On 3/29/07, Darryl Cousins <darryl at darrylcousins.net.nz> 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.
>
>
> -Fred
>
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?
Sincere regards,
Darryl
More information about the Zope3-users
mailing list