On Wednesday, 22 August 2012 15:28:50 UTC+2, Johann Spies wrote:
>
> Hallo Daniel,I have defined a database table which has some fields which
> must be computed:
>>
>>
>>
>> Field('password', 'password', length=512,
>> compute=automatic_password,readable
>> =False, label='Password'),
>>
>> The functions create_new_agent and automatic_password are part of my
>> libraries. They are returning the expected types (strings in both cases)
>>
>
> If you search the book for 'computed field' you will see that you need to
> use lambda in this case.
>
> Try
>
> Field('password', 'password', length=512, compute=lambda r:
> automatic_password(), readable=False, label='Password'),
>
>
> You did not show the code for 'automatic_password'. If that function
> needs an argument, then you will have to use automatic_password(r) in the
> above line.
>
> Regards
> Johann
> Regards
> Johann
>
--