Try replace output=rows with output=rows.as_list()
Perhaps the rows are not json serializable.
On Monday, 4 June 2012 02:20:39 UTC-5, Jan Rozhon wrote:
>
> Hi group, I have encountered a problem when I try to call a controller
> which should return a JSON array of values from database. However in abou 1
> of 5 cases this call stucks in "loading" phase (chrome animation in tab)
> and no response is received. Data is in database, every other controller is
> working fine, cpu utilization is pretty low so is the memory and there are
> only about 10000 rows in DB. Could you please give me some hints?
>
> Thanks, Jan
>
> PS. The controller looks like this:
>
> def dberrorsselect():
> """Performs sql query to get the errors in the form of list of dicts
> such as {field_name:value}. This is then transformed to json dict for
> transfer."""
> if session.tb_id:
>
> max_id=tb(tb.errors.test_id==session.tb_id).select(tb.errors.id.max()).first()[tb.errors.id.max()]
> if max_id != None:
> selector_id=int(max_id)-5
> else:
> selector_id=0
> rows=tb((tb.errors.test_id==session.tb_id)&(tb.errors.id >
> selector_id)).select(tb.errors.ts, tb.errors.msg_short, tb.errors.msg_long)
> output=rows
> else:
> output=[]
> return dict(output=output)
>
>
>