[web2py] Re: compute not working on update

2013-12-05 Thread 黄祥
tested in 2.8.2 still got the problem, about compute field during updates, although the update is not related with the compute field. e.g. update the status field on rent table, when i insert the revert / compensation table using after insert callback. yet the compute i use is for total_price

[web2py] Re: compute not working on update

2012-05-26 Thread peter
So def update_images(): rows=db(db.image).select() for row in rows: row.update(file=row.file) db.commit() does work. I wrote (title=row.title) as I was a little loath to write (file=row.file) as I was not sure if this was okay with 'upload' fields. Clearly it is. Thinking

[web2py] Re: compute not working on update

2012-05-26 Thread Massimo Di Pierro
Can you please open an issue about the compute on update problem? I will try reproduce and fix it. On Saturday, 26 May 2012 07:11:28 UTC-5, peter wrote: So def update_images(): rows=db(db.image).select() for row in rows: row.update(file=row.file) db.commit() does

[web2py] Re: compute not working on update

2012-05-25 Thread peter
Thanks I should have used update_record. However still no compute, and compute does not work when editing also. Peter On Friday, May 25, 2012 6:50:33 PM UTC+1, peter wrote: I am using web2py 1.99.7 I have a compute as db.image.thumb.compute=lambda r:THUMB(r['file']) I update the whole

Re: [web2py] Re: compute not working on update

2012-05-25 Thread Richard Vézina
Do you lambda is more complicated than what you show? If all the field required for the lambda to compute are not available it failed silently. For example : db.tab.field_computed.compute=lambda record: record.field1+record.field2 If field1 or field2 is not available the computation will not

[web2py] Re: compute not working on update

2012-05-25 Thread Anthony
db.image.thumb.compute=lambda r:THUMB(r['file']) def update_images(): rows=db(db.image).select() for row in rows: row.update(title=row.title) db.commit() Well, in this case, you update the title field, but the compute depends on the file field, so there would be

[web2py] Re: compute not working on update

2012-05-25 Thread peter
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

[web2py] Re: compute not working on update

2012-05-25 Thread Anthony
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

[web2py] Re: compute not working on update

2012-05-25 Thread LightDot
On Saturday, May 26, 2012 4:45:32 AM UTC+2, Anthony wrote: 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

[web2py] Re: compute not working on update

2012-05-25 Thread Anthony
So if the computation needs two fields and only one is updated, it won't execute on update. It makes sense when I rethink the logic, but I wouldn't have thought of this right away. I recommend mentioning this explicitly in the book. Here's the DAL code: