[web2py] Re: Encountering problem with a computer field

2010-12-22 Thread mdipierro
The problem is that you have compute attribute set at table definition so web2py tries to use it at every insert and every update. Even if in your update you is has no knowledge of the previous Alias_ordinal because you only updating Number_of_posts. There are two solutions... set db.table.field.c

[web2py] Re: Encountering problem with a computer field

2010-12-22 Thread Magnitus
Ah, ok. So basically, because the computed field is stored and updated during writes, it will get re-computed at every input (even if its dependencies are not changed) and expects its dependencies to be present in the input (ie, won't read the fields in the DB for missing values). I guess I shoul

[web2py] Re: Encountering problem with a computer field

2010-12-23 Thread cjrh
On Dec 23, 2:04 am, mdipierro wrote: > I can add a try except so that web2py does not tries to compute fields > when there is not enough information. The downside is that a typo will > result in a silent failure to compute. Perhaps we should do this > anyway. If you're going to be doing work in t

[web2py] Re: Encountering problem with a computer field

2010-12-23 Thread mdipierro
Need to think about it. On Dec 23, 3:51 am, cjrh wrote: > On Dec 23, 2:04 am, mdipierro wrote: > > > I can add a try except so that web2py does not tries to compute fields > > when there is not enough information. The downside is that a typo will > > result in a silent failure to compute. Perhap

[web2py] Re: Encountering problem with a computer field

2010-12-23 Thread Magnitus
I've thought about the dependencies problem a little bit. Maybe add some kind of hook so that the user can define the dependencies of the computed field himself. If he doesn't define them, the current behavior occurs. If he defines them, the behavior could be as follow: 1) All the dependencies

[web2py] Re: Encountering problem with a computer field

2010-12-23 Thread mdipierro
For now I have a simple try except. I will see if that you suggest is possible. Massimo On Dec 23, 11:33 am, Magnitus wrote: > I've thought about the dependencies problem a little bit. > > Maybe add some kind of hook so that the user can define the > dependencies of the computed field himself. >