On Wednesday, April 19, 2017 at 7:50:46 PM UTC-4, Chris wrote:
>
> Uh oh...I just removed requires from the computed field and reran my unit 
> tests, and now validate_and_insert inserts but the computed field isn't 
> calculated at all! I tried insert and it does the computation.
>
> Is there some reason validate_and_insert would not compute where insert 
> does?
>

The computed field will not get a value if any of the fields needed by the 
compute function are missing. Also, I notice that when 
.validate_and_insert() is called, if any of the fields are set to None, 
they end up getting dropped before being passed to .insert() (this should 
probably be considered a bug). So, if you are setting a field needed by the 
compute function to None, then that would cause the compute to fail. If 
that's not your situation, then you'll have to show more code to diagnose 
the problem.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to