On Thu, May 12, 2011 at 11:24 AM, Kiview <[email protected]> wrote: > Now, if I want to set a validator for my post method, it would > normally be done this way: > > @validate(new_movie_form, error_handler=new) > @expose() > def post(self, **kw): > # Code here > > > But when using the declerative way, I don't hab the new_movie_form > object, or do I? > Don't know what's the best way to go from here. Or would it be better > to use a non declarative style? >
Just one curiosity, do you really need declaring your own post method when using the CrudRestController? Your form seems quite simple, in those cases CrudRestController is usually able to save the things by himself. Anyway If I remember correctly the tgext.crud.decorators should provide a @registered_validate(error_handler=?) that automatically detects the form to validate by the method. "post" usually validates with the new_form_type. You can change it inside the controller constructor by calling: register_validators(self, 'post', FormToValidate) -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.

