Nice patch. Apart from the comment by andrei (with which I agree), I'd just add one more thing. It makes things much easier if you specify form-level validators as a single attribute (say ``__validators__``), and make it an iterable.
On Wed, Oct 20, 2010 at 7:09 PM, Daniel Garcia Moreno <[email protected]> wrote: > Hi everyone, I've been thinking about web.py forms, and I realize that > it could be great if you could define a form defining a class. Something > like that: > > from web import form > > > class MyForm(form): > name = form.Textbox('name') > password = form.Password('password') > password2 = form.Password('password2') > > validator1 = form.Validator("Passwords didn't match.", lambda i: > i.password == i.password2) > > > and then use like normal web.py form: > > f = MyForm() > f.render() > ... > f.validates() > ... > > I write a patch to make that avaliable in current web.py. > > What do you think about that? > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > > -- Branko Vukelić [email protected] [email protected] Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
