I think I am making something that make web2py confuse... Here one of my
lamdba :


lambda row : '%s%s%s%s-%02d%05d'
%(str(db.ref_product_code(int(row['product_code_id'])).product_code_code),str((db.ref_process(int(row['process_id'])).process_letter_code)),str(db.ref_production_site(int(row['site_id'])).production_site_code),str(db.ref_lot_vocation(int(row['lot_vocation_id'])).lot_vocation_code),int(row['lot_number_production_lot_year']),int(row['lot_number_production_lot_sequential']))

I try to get fk id replace by foreign table values... It works fine on
inserted but for a reason I ignore it not working on update... I make sure
that every key needed by the lambda compute function are there in
form.vars, so I really don't understand why the lambda won't compute...

I try what Richard suggest above (what I think Richard mean by it dirty
tricks) but I didn't get any key error that had poped up... Should I assume
that the lambda got what it needs??

Or maybe my complex lambda falls in some hole within the "dal compute
logic" when update record???

Thanks.

Richard

On Tue, Jan 3, 2012 at 5:56 PM, Richard Vézina
<[email protected]>wrote:

> Hello Richard,
>
> Do you means those lines :
>
>         for ofield in self:
>             if not ofield.name in new_fields_names and ofield.compute:
>                 #try:
>                 new_fields.append((ofield,ofield.compute(Row(fields))))
>                 #except KeyError:
>                 #    pass
>
> Around line 5583 in dal.py in web2py 1.99.4
>
> ??
>
> Richard
>
> On Tue, Jan 3, 2012 at 5:38 PM, Richard Vézina <
> [email protected]> wrote:
>
>> Thanks! I do that...
>>
>> Richard
>>
>>
>> On Tue, Jan 3, 2012 at 5:12 PM, Richard Galka <[email protected]>wrote:
>>
>>>  A quick and dirty way to check what is going on is to add debug
>>> statements in the web2py dal.py code.
>>>
>>> I had a similiar issue, and the quickest way I found to check why
>>> compute failed was to remove the "except KeyError" in the "def _lisitfy" of
>>> dal.py. Then an error is thrown whenever the compute method fails, and you
>>> can view all the data, session, etc... in web2py
>>>
>>> Good luck!
>>> -- Richard
>>>
>>
>>
>

Reply via email to