Yah right!

        row = db[request.args(0)](request.args(1))
        for f in db[request.args(0)].fields:
            if f != db[request.args(0)]._id and f !=
db[request.args(0)].record_review_status:
                form.vars[f] = form.vars.get(f, row[f])


My table is kind of not normalized... Many fields are just showed (not
writeable) and the user check a box to review them... These records are
missing, but they are not all required for the compute to work.

Should my compute have to be in the form.vars to compute?

Should I explicitly have to redifined it or append it like so :

form.vars[mycompute] = db.table.mycompute.compute

?

Richard

On Thu, Mar 5, 2015 at 5:14 PM, Anthony <abasta...@gmail.com> wrote:

> On Thursday, March 5, 2015 at 4:18:06 PM UTC-5, Richard wrote:
>>
>> Yes I struggle with it to make compute works...
>>
>> I come up with something like this :
>>
>> after .accepted
>>
>> for f in db[request.args(0)].fields:
>>             if f != db[request.args(0)]._id and f !=
>> db[request.args(0)].record_review_status:
>>                 form.vars[f] = form.vars.get(f,
>> db[request.args(0)](request.args(1))[f])
>>
>
> If it is an update form, all the fields should be in the form already
> (unless they were explicitly excluded from the form). Also, the above does
> a separate database select for every missing field -- it would be better to
> fetch the record just once and then read the fetched record.
>
> 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 web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to