Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form generation/validation libraries in Python

I'm a developer in Python coming from a PHP background. In PHP most frameworks included a decent form generation/validation API (Zend and CakePHP come to mind). At my new company we try to stay away from Django and use Werkzeug extensively.

I've looked at FormEncode and Formular. Formular seems better to me, but there must be stuff my noobish brain is not aware of. Please enlighten me.

like image 952
Patrick Krecker Avatar asked Jul 30 '10 15:07

Patrick Krecker


2 Answers

There's also WTForms, which is a fairly minimal forms library that integrates well with Werkzeug in my experience.

like image 149
Walter Mundt Avatar answered Nov 10 '22 02:11

Walter Mundt


FormEncode is more a validation library and not very good at generating forms.

Personally, I don't like to intermix output generation (forms) and validation. As I see some shortcomings in FormEncode, which tried to remove in my own implementation called pycerberus. However it doesn't do any form generation at all.

The reason why I don't like to have html generation + validation together is that because:

  1. I need validation also in non-ui contexts like server applications, libraries and I don't want to switch libraries but maintain one toolset.
  2. There are very good tools for output generation and I'd like to choose the one that suits me best. In case I need extra functionality there, the choice is really limited.
like image 23
Felix Schwarz Avatar answered Nov 10 '22 02:11

Felix Schwarz