Kevin Dangoor wrote:
On 11/1/05, Ian Bicking <[EMAIL PROTECTED]> wrote:

Kevin Dangoor wrote:

You can instantiate a form like this:
myform = TableForm(widgets=[
               widgets.TextField("name"),
               widgets.TextField("address"),
               widgets.TextField("age", default=0,
                               validator=validators.Int())])

Isn't that just begging to be...

class myform(TableForm):
   name = widgets.TextField()
   address = widgets.TextField()
   age = widgets.TextField(default=0, validator=validators.Int())

?


I don't think so. In this example, I'm not looking to create something
that creates forms (a class), I'm looking for a form itself (an
instance).

I'm thinking from a syntactic point of view, not necessarily the classness. This is similar to FormEncode schemas.

They can remain ordered, if TextField uses a counter to track when they were created relative to each other.

OTOH, this is something that creates forms! You can't send this Python code to the client, you send what this code renders, in the context of a specific request. That is a reasonable way to distinguish classes and instances.

--
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org

Reply via email to