On Jan 11, 2007, at 8:25 PM, Lee McFadden wrote:
> > On 1/11/07, Alberto Valverde <[EMAIL PROTECTED]> wrote: >> >> It's a good idea, however, I would not bother too much with patching >> the trunk with this ATM because (apart that you'll probably lose much >> hair ;) decorators are going to be rewritten in a much simpler way >> (just registering behaviour and returning the orginal, undecorated >> function) so any changes will be probably lost. >> > > I *don't* think it's a good idea. Controllers are exposed for a > reason, they're supposed to be called by the web and at no point will > you want your exposed method to return python objects - the browser > will not know how to deal with it (and neither will cherrypy for that > matter). The reason exposed methods return a string is because your > data is automatically JSONified for you. After thinking more about it I'll have to agree with Lee. "tg_format" can be passed as a request parameter and it will be too easy to make your app throw a 500, beside's that, exposed methods' output (after being processed by decorators) should be something a UA understands. > > If you want something extensible, create a function that does all the > heavy lifting and returns your data how you want it, then use an > exposed method to wrap it. That way you can use the wrapped function > in any other part of your application or, in fact, any application at > all. > > Lee > -- > Lee McFadden > > blog: http://www.splee.co.uk > work: http://fireflisystems.com > skype: fireflisystems > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
