thanks Michele

alas that change returns "invalid view (default/stockPrices.html)"
presumably because there is no view or no view with "prices" defined.

I'm looking for something that allows my existing Pyjamas app and new GWT
app to call the same functions. That gives me a good way to test the new
GWT app as I'll have a working Pyjamas app alongside.

On 2 April 2012 11:34, Michele Comitini <michele.comit...@gmail.com> wrote:

> Carl,
>
> You may find the @service.json annotation useful.
> Try the following:
>  return dict(prices=prices)
>
> Il 02 aprile 2012 11:08, Carl <m...@carlroach.com> ha scritto:
> > I'm looking at the example StockWatcher.java from GWT modified to use
> JSON
> > and call a Web2py server app.
> >
> > In the client app I'm
> > using: http://127.0.0.1:8000/init/default/stockPrices.json?q=ABC
> > note the ".json" extension.
> >
> > In my default.py in Web2py I have:
> > def stockPrices():
> >     sym = request.vars['q']
> >     rows = db(db.stock_price).select()
> >     prices = rows.find(lambda row: row.symbol in sym).as_list()
> >     return json.dumps(prices)
> >
> > Is there an approach in Web2py I can use that I don't need to call
> > json.dumps() when returning "prices" ? What are others doing?
>

Reply via email to