I think the behaviour of "compute=" is not good. Most people need
calculated field which ALWAYS follow the source values and not just ONCE.
So I have found in google group, lot of people fall through the time in
same problem and there is still no clear solution.
I now need this for Markmin source and calculated Html output (both fields
in same table)
I have solved this so:
...Field('html', compute = lambda row: MARKMIN(row.markmin).xml())...
and in addition I use "onaccept" method in form:
def post_forcecompute(form):
row = db.post(form.vars.id)
row.update_record(html=db.post.html.compute(row))
crud_post.settings.update_onaccept = post_forcecompute
This works, however it is not very good workaround, because it is
neccessary to solve it in form, instead of in the model :(
Mirek
Dne čtvrtek, 29. prosince 2011 21:36:35 UTC+1 Richard napsal(a):
>
> Ping!
>
> computed field not compute on update... What should I check?
>
> Thanks
>
> Richard
>
> On Wed, Dec 28, 2011 at 4:50 PM, Richard Vézina <
> [email protected]> wrote:
>
>> Hello,
>>
>> I would like to compute a field on update, but I think all the
>> request.vars needed to my lambda compute function are not passed to
>> form.vars...
>>
>> What I should do to make sure all the needed vars are available to the
>> lambda compute function?
>>
>> form.vars.varname = request.vars.varname ??
>>
>> Thanks
>>
>> Richard
>>
>
>
Dne čtvrtek, 29. prosince 2011 21:36:35 UTC+1 Richard napsal(a):
>
> Ping!
>
> computed field not compute on update... What should I check?
>
> Thanks
>
> Richard
>
> On Wed, Dec 28, 2011 at 4:50 PM, Richard Vézina <
> [email protected]> wrote:
>
>> Hello,
>>
>> I would like to compute a field on update, but I think all the
>> request.vars needed to my lambda compute function are not passed to
>> form.vars...
>>
>> What I should do to make sure all the needed vars are available to the
>> lambda compute function?
>>
>> form.vars.varname = request.vars.varname ??
>>
>> Thanks
>>
>> Richard
>>
>
>
Dne čtvrtek, 29. prosince 2011 21:36:35 UTC+1 Richard napsal(a):
>
> Ping!
>
> computed field not compute on update... What should I check?
>
> Thanks
>
> Richard
>
> On Wed, Dec 28, 2011 at 4:50 PM, Richard Vézina <
> [email protected]> wrote:
>
>> Hello,
>>
>> I would like to compute a field on update, but I think all the
>> request.vars needed to my lambda compute function are not passed to
>> form.vars...
>>
>> What I should do to make sure all the needed vars are available to the
>> lambda compute function?
>>
>> form.vars.varname = request.vars.varname ??
>>
>> Thanks
>>
>> Richard
>>
>
>