[web2py] Returning JSON data to a GWT client app

2012-04-02 Thread Carl
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 =

Re: [web2py] Returning JSON data to a GWT client app

2012-04-02 Thread Michele Comitini
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

Re: [web2py] Returning JSON data to a GWT client app

2012-04-02 Thread Carl Roach
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

Re: [web2py] Returning JSON data to a GWT client app

2012-04-02 Thread Michele Comitini
Carl, Try the code below for plain json. For pyjamas you can use jsonrpc it works well with web2py. See the web2py book to learn how to use the @service annotation. def call(): session.forget() return service() @service.json def stockPrices(q): sym = q rows =

Re: [web2py] Returning JSON data to a GWT client app

2012-04-02 Thread Carl Roach
yes... I've been using @service.json and my Pyjamas app can call such decorated and retrieve json-formatted data. all I need to do is return {'tag1', data1', 'tag2', data2} I now want to know how I can get a GWT app to call the same function. Anyone using GWT with Web2py? On 2 April 2012 11:34,

Re: [web2py] Returning JSON data to a GWT client app

2012-04-02 Thread Michele Comitini
Just to clarify things : JSONRPC!=JSON jsonrpc is a json specialization used as protocol to call remote procedures. web2py can be used to publish *jsonrpc* services using @service.jsonrpc mic Il giorno 02/apr/2012 16:33, Carl Roach m...@carlroach.com ha scritto: yes... I've been using