Correct me if I'm wrong, but I don't think this preserves the input order. getattr will just try to access the __dict__ of the object (and then the parent, etc), but it won't preserve order of the output. This means that calling render on that object will produce weird layouts.
On Oct 20, 10:09 am, 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? > > 0001-Allow-declare-forms-using-inheritance.patch > 1KViewDownload -- 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.
