On Friday, October 21, 2011 5:49:50 AM UTC-4, andrej burja wrote: > > with > row[sum] > it doesn't work > <type 'exceptions.KeyError'>('<built-in function sum>') > > "Actually, the above will only work if the controller returns 'sum' in the > dictionary -- otherwise it will be undefined in the view." > what shoul i change in the controller? >
You define 'sum' in the controller, so you have to pass it to the view in order to reference it in the view. So, in the controller, instead of: return dict(rows=rows) do return dict(sum=sum, rows=rows) Actually, because 'sum' is a Python builtin, you might be better off naming it something else. Anthony