views:

106

answers:

2

As the title states, I am looking for something, that will help me automate form processing (validation/rendering/etc) in twisted.web. I am also looking for a suitable templating toolkit to use with it.

As for templating, it is not so much of an issue as there are a lot of libraries in python, that do it. I was considering the following:

  • Nevow. Well, it is not only a templating toolkit, but a lot of other things that I may or may not need. It also plays nice with twisted's asynchronous nature (as far as I know, you can do incremental rendering with it, whether that is good or bad)
  • Jinja2. I haven't used it yet, but people seem to recommend it a lot. I've read about it and it seems to be a decent toolkit.
  • Genshi. same as the previous one
  • Django's templating engine. I've used it quite a lot. There are some drawbacks, but, well, it works. This is not a django project, so there is no need to restrict myself to django's components, though.
  • Hell, I can theoretically generate xhtml using xslt (but I won't :P), since almost all the data the project deals with is xml

As for form processing, I must say, that the only python web framework I am familiar with is django (quite familiar with it, actually) so I don't really know what I should be considering here.

I know nevow has some kind of form processing built-in, apparently (called formless), but I have no idea how good it is and I haven't found any documentation (besides the source) or usage examples (besides the completely trivial one in the turorial).

The other option I was considering is "bolting on" django's forms, since the forms are not really coupled to anything else in django, so it is possible to use them separately. I'd rather not do it, though, if it is at all possible.

Maybe someone with an existing twisted.web project can give me a hint or two.

+1  A: 

I really like Jinja2. It's an improved form of the django templating system. I use it pretty extensively in my projects.

For form processing, you may want to check out formosa.

Ryan Ginstrom
Thanks, I was not aware of the existence of formosa. I was actually taking a look at formencode (http://formencode.org/).
shylent
+1  A: 

My experience of Nevow is that examples and documentation are hard to find on the web. There are some basic ones linked from the Nevow homepage (http://divmod.org/trac/wiki/DivmodNevow), but nothing like the volume of examples and questions/asnwers you would see with the larger Java frameworks (which I am more familiar with) for example.

This seems to be borne out with some simple google searches:

  • search for Python Nevow returns approx 155k results
  • search for Python twisted returns approx 1000k results
  • search for Python Django returns approx 19,700k results
  • search for Java Spring returns approx 13,000k results

I realise this is not too scientific but it does support my experience. I would be very happy for someone to correct this if I have missed something and point us all towards a rich source of Nevow (and especially Athena, the Ajax component) documentation...

Mick