16

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.

2
  • 1
    Also wtforms. I've used them on a few Pyramid applications and am happy with them. Probably a lot of subjectivity here but FWIW wtforms is relatively mature, so worth inclusion in the discussion.
    – chris
    Feb 3, 2013 at 19:15
  • @george Best post it as an answer I think, more people will see it and can give their feedback Feb 4, 2013 at 0:12

4 Answers 4

11

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.

1
  • Addentum : simpleform doesn't seem to be using deform any more. The rest of the consideration still hold.
    – madjar
    Nov 8, 2012 at 9:42
3

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.

2

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.

0

For your information, deform is used by :

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.