Thanks Michael. Yes, I am aware of CrudRestController. I didn't want to use sprox and their generated forms. Hence trying to roll my own where you have more flexibility with the templates.
On May 21, 2:17 pm, Michael Pedersen <[email protected]> wrote: > I'm not sure that I follow your question very well (decorators are still a > weak point for me), but, from the name of your class, you might be trying to > override already done functionality. Take a look at tgext.crud, the > TurboGears CrudRestController. Docs are > overhttp://turbogears.org/2.1/docs/main/Extensions/Crud/index.html > > If I'm wrong, I apologize, and will try to help (though I don't know how > much help I will be). > > > > On Fri, May 21, 2010 at 2:04 PM, steve <[email protected]> wrote: > > Hi, > > > I am trying to write a base crud controller class that does the > > following: > > > class BaseCrudController: > > model = "" > > field_validation = {} > > template_dir = "" > > > �...@expose(self.template_dir) > > def new(self, *args, **kwargs) > > .... > > > �...@validate(self.field_validation, error_handler=new) > > �...@expose() > > def post(self, *args, **kwargs): > > ... > > > My intent is to have my controllers extend this base class, set the > > model, field_validation, and template locations, and am ready to go. > > > Unfortunately, decorators (to my understanding), are interpreted when > > the function is defined. Hence it won't have access to instance's > > value. Is there a way to pass in dynamic data or values from the sub > > class? > > > If not, I guess I could use override_template as a workaround to > > expose and set the template within the controller action. How would I > > go about validating the form within the controller action? > > > Thanks, > > Steve > > > -- > > 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]<turbogears%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/turbogears?hl=en. > > -- > Michael J. Pedersen > My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171 > Yahoo/pedermj2002, MSN/[email protected] > > -- > 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 > athttp://groups.google.com/group/turbogears?hl=en. -- 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.

