Thanks for the update!
I'm passing all of the fields needed by the compute function. It looks
something like this:
dct_new_user = { fields here }
# new_user = db.auth_user.insert(**dct_new_user)
new_user = db.auth_user.validate_and_insert(**dct_new_user)
The former calculates the computed field, but the latter does not.
On Thursday, April 20, 2017 at 7:57:12 PM UTC-4, Anthony wrote:
>
> I'm not sure if this is the cause of your problem, but I just posted an
> issue: https://github.com/web2py/pydal/issues/462
>
> Anthony
>
> On Thursday, April 20, 2017 at 10:30:14 AM UTC-4, Anthony wrote:
>>
>> 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.