On Friday, May 25, 2012 10:13:45 PM UTC-4, peter wrote:
>
> Thanks yet again Anthony. It makes sense that it only recomputes when the 
> relevant fields change. I think it would be valuable to change the book as 
> it implies (at least it did to me) that the computed value is computed on 
> any update of the record, 
>
> "When a new record is modified, including both insertions and updates, if 
> a value for the field is not provided, web2py tries to compute from the 
> other field values using the compute function. "
>

Yes, I guess to be more clear, it should indicate that on updates, it tries 
to compute the value using the fields being updated. If one of the fields 
required to compute the value is not included in the update, then the 
compute won't be updated. Note, the compute should happen as long as it 
doesn't require any fields that are not being updated. So, this should only 
be a problem if the compute requires multiple fields, and some of them are 
being updated and some are not. To accommodate that case, though, the DAL 
would have to retrieve the existing record from the db in order to get the 
current values of the fields that aren't being updated. Of course, you 
could always do that explicitly in your code and then include those fields 
in the update as well.

Anthony

Reply via email to