I would also suggest using simplejson to escape your strings for you.
import simplejson
class ExampleController(controllers.Controller):
@expose()
def example(self):
mydata = [i for i in range(1,50)]
return simplejson.dumps(mydata)
On 9/29/07, Huang Yong <[EMAIL PROTECTED]> wrote:
> I resolved that.
> add @expose() ahead,then return a string which you want to return.
>
>
> On 9/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I'm trying to implement a demo "http://extjs.com/deploy/ext/
> > examples/grid/paging.html" of extjs Lib with turbogears.
> >
> > This page uses a ScriptProxy object to send a request and handle
> > the response.It expectes a special format of responseText which looks
> > like "callback001( {"key":"value"} )".
> >
> > In turbogear, we can use @expose("json") to return a JSON
> > object.But how can I insert "callback001(" to the head and append ")"
> > at the tail?
> >
> > thanks for you reply.
> >
> >
>
>
> >
>
--
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" 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
-~----------~----~----~----~------~----~------~--~---