[Twisted-web] twisted.web2+Cheetah+FormKit

Andrea Arcangeli andrea at cpushare.com
Thu Jan 19 09:19:35 MST 2006


What do twisted-web readers think about FormKit as a replacement for
formless? (Cheetah replaced the template rendering of nevow already)

I really want to use the library approach with no connection between the
webserver and the html rendering _at_all_. My code will plug on top of
web2 only. The html rendering code must know nothing about the
webserver because it doesn't need to. At most the html rendering code
may learn about what a deferred is, but the deffered callback is the
maxmium connection I want between html rendering and web server.

Being able to mix something like FormKit with Cheetah for the html
rendering seems to be a reasonable path. Cheetah will have the template
with something like $form inside, and FormKit will render the html to
put in the template (t.form = f.tag()). This is really strightforward
because the form rendering is non-blocking (modulo the cpu cost of it),
so doing it under twisted.web2 or under mod_python with apache will be
exactly the same code.

FormKit gets a dict in input for processing, that should fit well with
the web2 post params too.

Here an example:

	http://formkit.python-hosting.com/file/tags/r_0.9b2/Examples/compound-field-example.py

The great bonus of the library model, is that this time if the FormKit
project becomes obsolete like nevow.formless, it'll be truly easy to
embed FormKit inside my app because its only dependency is python.
The same is true for Cheetah of course. So depending on it may be
reasonably safe and it should avoids to write big html by hand. I think
I'll try it, then if it misses too many features, I'll give it up and
write the html of the forms by hand (perhaps you didn't notice but I
really dislike forms html, that was the main reason I liked nevow
initially ;).

I feel this time with twisted.web2 things will go well.



More information about the Twisted-web mailing list