[Zope3-Users] Re: formlib vs. cancel button

Marius Gedminas mgedmin at b4net.lt
Thu Feb 15 09:45:16 EST 2007


On Thu, Feb 15, 2007 at 09:55:19AM +0000, Martin Aspeli wrote:
> Dennis Schulz wrote:
> >I dont know if it is the "proper" way,
> >but when I return an empty string there is no validation error.
> >
> >This was also one of the strangest things I found out with formlib.....
> 
> I found that returning {} also works.

The validator is supposed to return a list of errors.  Neither '' nor {}
are lists.  () is a list.  I use

    @form.action("Cancel", validator=lambda *a: ())
    def cancel(self, action, data):
        ...

> But this is clearly a design 
> weakness if there is no other way of doing it. Something like 
> validator=NULL_VALIDATOR would be fine, or some kind of decorator.

+1 for allowing

    @form.action("Cancel", validator=form.no_validation)

Note that as a side effect of an empty validator you will always get an
empty data dictionary in the handler method.

Marius Gedminas
-- 
<Corsac> yeah, i'm reading the answers, currently
<Corsac> but what I see is that there is no real procedure to rebuild initfs
<Corsac> the common way seems to use a loop device with a jffs2 filesystem, put
         original files there, and add other files, then umount, flash and pray
   <dwd> Corsac: You forgot "ritual sacrifice of a medium sized rodent".
         Without that, it'll never work.
   <zuh> And if it doesn't work the first time, re-adjust towel ordering in the
         restroom and try again
                -- #maemo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20070215/91d55360/attachment.bin


More information about the Zope3-users mailing list