Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyramid: simpleform or deform?

Tags:

python

pyramid

For a new (Python) web application with the Pyramid web framework, I'd like to use a form binding and validation library and so far found simpleform and deform. Does anyone have experience with these, and can tell me why I should pick one or the other? I am not using an ORM, just POPO's so to say.

I think I would prefer the easiest for now.

like image 336
Jasper van den Bosch Avatar asked Apr 14 '11 15:04

Jasper van den Bosch


2 Answers

I've not had extensive experience with either, but so far this is what I've learned.

They both use colander (which I very much like) for definition and validation of forms. In my opinion what really sets them apart is their rendering mechanisms. In this regard, deform is the most straightforward in the sense that it allows you render the whole form by just doing form.render() in your template. On the other hand, with simpleform you must render each field manually. This could be either a good or bad thing depending on what you need.

A drawback with simpleform is currently there is no clear way to handle sequence schemas in templates.

edit: Also, in my opinion, deform has better documentation available.

like image 122
rhyek Avatar answered Oct 21 '22 16:10

rhyek


I haven't used simpleform yet, but I have been using deform for a project I'm currently working on. deform allows you to render templates from a colander schema, which is very handy. Also, if the schema is violated you can simply call ValidationFailure.render() (after catching the ValidationFailure exception) and a message that you can customize is rendered with the form. I'm currently grappling with the choice between rendering the entire form and rendering it piece by piece. It would be really nice if you could group components together for rendering.

like image 24
gred Avatar answered Oct 21 '22 16:10

gred