Not sure I follow, in the pass we were allowed to define a legacy id for a
table like this :
db.define_table('test_endotoxin',
*Field('something_id','id'),*
Field('result','decimal(10,2)',
notnull=True,
requires=[IS_NOT_EMPTY(error_message=T('field can\'t be empty')),
IS_DECIMAL_IN_RANGE(0.00,99999999.99)],
required=True
),
...)
It still work except at the level of the row object.
What you suggest may works, I would have to refactor and create a virtual
field for all my tables...
I was seeking for a solution that prevent me from refactoring in order to
shift from 1.99.4 to 2.0... when there will be a stable version.
Richard
On Tue, Aug 28, 2012 at 12:39 PM, Massimo Di Pierro <
[email protected]> wrote:
> How about
>
> table.id = Field.Virtual(lambda row: row.table.something_id)
>
>
> On Tuesday, 28 August 2012 10:30:37 UTC-5, Richard wrote:
>>
>> Hello Massimo,
>>
>> I notice when I try to migrate to 1.99.7 some times ago that I could not
>> anymore do something like this :
>>
>> rows = db(db.table.id>0).select()
>>
>> for row in rows:
>> print row.id
>>
>> I can did it before 1.99.5.
>>
>> Has Anthony wrote in this thread : https://groups.google.com/**
>> forum/#!msg/web2py/**i7wx6JVTOtw/FRnScZzhqHgJ<https://groups.google.com/forum/#!msg/web2py/i7wx6JVTOtw/FRnScZzhqHgJ>
>>
>> We still can do :
>>
>> db.table.id even if the "real" table id name (or legacy id name) is
>> something else like : something_id
>>
>> To me it is just a matter to have a alias for any legacy id name when
>> creating a row object :
>>
>> Row in 1.99.4
>> <Row {'something_id': 252, 'update_record': <function <lambda> at
>> 0x215eaa0>, 'field1': Decimal('5.55'), *'id': 252*, 'delete_record':
>> <function <lambda> at 0x215eb18>}>
>>
>>
>> Row in 1.99.5-1.99.7
>> <Row {'something_id': 252, 'update_record': <function <lambda> at
>> 0x215eaa0>, 'field1': Decimal('5.55'), 'delete_record': <function <lambda>
>> at 0x215eb18>}>
>>
>> Could we have it back or it is gone?
>>
>> Thank you.
>>
>> Richard
>>
> --
>
>
>
>
--