works for me. Do you have a views/generic.json? If you do did you enable it?
response.generic_patterns = ['/myapp/dashboard/call_stats.json'] On Saturday, 8 September 2012 03:59:47 UTC-5, Daniel Gonzalez wrote: > > Hi, > > I am trying to access an action returning json data. According to Example > 12 here: http://www.web2py.com/examples/default/examples, all actions > requested with .json and returning a dict are automatically converted to > json. But this is not working for me, maybe because routing is interfering. > > I am using a router, like this: > > routes_in = ( > ('/call_stats.json', > '/myapp/dashboard/call_stats.json'), > ) > > My client is calling call_stats.json, but I just get this > response: "invalid view (dashboard/call_stats.json)" > > I have tried several combinations of router settings (with and without > .json) > > This is my action, in controller dashboard.py: > > def call_stats(): > return CallStats().get_stats() > > Which is returning a dict. How can I tell web2py that that action needs to > be served as json? > > Thanks > Daniel > --