[web2py] Re: Output of sum(), simplifying the JSON

2011-01-15 Thread Michael Toomim
I find it easiest and cleanest to reformat data structures in python, using list comprehensions. Javascript sucks for loops. So instead of jsonifying the raw database output, fix it first: export_optimizer_records = [{'FreezeTime': r.panel_1hrs.FreezeTime, 'StringID': r.panel_1hrs.StringID,

[web2py] Re: Output of sum(), simplifying the JSON

2011-01-15 Thread Massimo Di Pierro
Mind that this is old syntax: r._extra['sum(panel_1hrs.Po_avg)'] it is equivalent and better to use: r[db.panel_1hrs.Po_avg.sum()] On Jan 15, 2:29 pm, Michael Toomim too...@gmail.com wrote: I find it easiest and cleanest to reformat data structures in python, using list comprehensions.