The nice thing about working with Python is that it seems there's so much code out there that's similar to how I would have written the code. FunFormKit is similar to my form/action library. After a quick glance at the site, I think I like how I structured mine a little better, but if I can use their code and avoid having to rewrite my own I'm all for it. What's nice is that their code is more complete than mine ever was.
In case you're interested, the way I structured mine was as follows: FunFormKit is set up in terms of the HTML elements that will be printed. I split the structure of it into two separate components... "actions" which handle the logical structure of the form, how to validate it, and how to process the result, and a "form helper" which took that logical structure and printed it as an HTML form. You could give hints to the helper about how you wanted a certain field printed, and if you didn't give it any hints it would try to choose a sensible default.
To give an example of what I'm talking about, a set of radio buttons, a single-select list box, and a drop-down box all have the same data model, as do a set of checkboxes and a multi-select list box. Similarly for text fields and and text areas. So, for the radio buttons example, you could specify a list of options and indicate that only one was required, and then you could print it any way you chose using the form helper. The form helper even had nice convenience functions for printing a whole bunch of checkboxes or radio buttons in rows and columns.
This separation was nice and logical, and it was really nice to be able to specify actions with no concern for how they would be laid out on an HTML form. But in practice, the scheme FunFormKit uses is probably plenty good enough. We'll see.
Update: Note that in addition to the "hints" you could give to the form helper, you could use it to print fields directly and have full control. If I do write my own, I'll probably try to provide some code meant to be used with Cheetah that'll make it easier to print form fields in a template.
new⇒Johnny Walker Blue Label
Wow, thanks for the scotch review:D
Lagavulin and Laphroaig aresome of...
Keith: Aug 29, 3:35pm