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 <fbunny2...@hotmail.com> 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. > > If he doesn't define them, the current behavior occurs. > > If he defines them, the behavior could be as follow: > > 1) All the dependencies are present in the input > > The field is updated from the input > > 2) Part of the dependencies are present in the input > > The current behavior occurs. Alternatively, try to read the missing > dependencies from the DB (for an update) or from the default values > (for an insert), but I'm not sure how complicated that would be. > > 3) None of the dependencies are present in the input > > The computed field is not updated. > > From the above, you'd get the best of all worlds. > > 1) User friendliness: The user doesn't have to define dependencies if > he doesn't want to and he'd get the current behavior. > > 2) Flexibility: The user can define dependencies in which case the > computed field doesn't restrict updates that don't include the > dependencies on the field. > > 3) Correctness: Exceptions due to mistyping variables are not caught > and properly raised. > > On Dec 23, 9:11 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > Need to think about it. > > > On Dec 23, 3:51 am, cjrh <caleb.hatti...@gmail.com> wrote: > > > > On Dec 23, 2:04 am, mdipierro <mdipie...@cs.depaul.edu> 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 the area of compute anyway, is > > > there a posssibility of making another change that the current value > > > of the compute-ed field can be passed to the compute method?- Hide quoted > > > text - > > > - Show quoted text - > >