On Sunday, October 23, 2011 11:49:31 AM UTC-4, Massimo Di Pierro wrote:
>
> lines[cash_price]=lines(cash_price) or 0  
>

I don't think that will solve the problem. That will add a new 
'SUM(orderline.cash_price)' key to lines rather than updating 
lines._extra['SUM(orderline.cash_price)']. However, when you subsequently do 
lines[cash_price], it will pull the old value from 
lines._extra['SUM(orderline.cash_price)'] and ignore the new value stored in 
the new key. This is because Row.__getitem__ always gets the value stored in 
_extra when the key is in _extra (
http://code.google.com/p/web2py/source/browse/gluon/dal.py#3888). To enable 
the assignment, I guess you'd have to update Row.__setitem__ so it would 
update _extra when the key is in _extra (though not sure if there are any 
downsides to that).

Anthony

Reply via email to