[Grok-dev] How to create Cancel that doesn't validate form in grok.EditForm

Leonardo Rochael Almeida leorochael at gmail.com
Thu Dec 11 08:59:42 EST 2008


having to repeat "lambda *args, **kwargs: {}" kind of sucks. I usually
define it to a constant in my apps, but I think it'd be nice if grok
defined it as grok.FormNoValidation or somesuch.

Cheers, Leo

On Thu, Dec 11, 2008 at 11:56, Andreas Kaiser <kaiser at xo7.de> wrote:
>
> Sebastian Ware wrote:
>
>> In a grok.EditForm, how do I mark an action so it doesn't require
>> validation of the form?
>>
>> I am thinking about the use case "cancel". I don't want to get error
>> messages due to invalid input if I choose the "cancel" action.
>
> I don't know if it applies to grok.EditForm as well, but this is what
> I've done with a grok.Form:
>
>     @grok.action('Cancel', validator=lambda *args, **kwargs: {})
>     def cancel(self, **data):
>         self.redirect(self.application_url())
>
>
> HTH,
>
> Andreas
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list