> > I think there was a notion to make validate into a "real" > > decorator with no particular hooks in the TurboGears controller's > > __call__ method. That would make it easy enough to replace the TG > > validator with custom validators from tosca, or wherever. > > Count me as a huge -1 on this idea. "Real" decorators are often > "real" difficult to debug. I'd greatly prefer it if we could just > make the existing validate decorator more extensible by allowing you > to pass in callables. All of the gain, with none of the hassle! > > We specifically did it this way, because we didn't like how the > previous TurboGears 1.x decorators ended up nesting your controller > methods tons of times, producing insane stack traces.
I agree with that on some basic level, but I also think it's important to differentiate @validate from @expose. @validate is designed to change the method signature, whereas @expose should not. @validate is a reasonable candidate for somebody to switch out with a new implementation, and @expose is not. I'm not so worried about @validate as I was about expose, the decorator version of @validate wouldn't require extra work to maintaint the method signature, and would have a very well-understood scope. I haven't done it, but I think the "actual wrapper" version of validate wouldn't be much more code, or much more difficult to read. Alberto particularly wanted to be able to supply his own validate in ToscaWidgets, and if there's signficant benifit in letting people tweek validate, it makes sense to decouple it from the controller so that people could much more reasonably do that. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" 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-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
