Jasper van den Bosch
Jasper van den Bosch

Reputation: 3218

Pyramid: simpleform or deform?

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.

Upvotes: 16

Views: 4984

Answers (4)

gred
gred

Reputation: 632

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.

Upvotes: 3

sverbois
sverbois

Reputation: 19

For your information, deform is used by :

Upvotes: 0

moschlar
moschlar

Reputation: 1336

Though it's a third alternative, but have you considered ToscaWidgets2?

From a quick glance on simpleform and deform, it seems to me that Toscawidgets2 is the golde middle between those two in case of features and simplicity.

There's even a tutorial for using it with Pyramid, just drop the database part and supply the form values as a dict.

Upvotes: 2

rhyek
rhyek

Reputation: 1869

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.

Upvotes: 11

Related Questions