Hi Mdipierro,
Could you please elaborate, I tried
Field('access_key', 'string', readable=False, writable=False,
default=lambda r:defaultUserInfo(r['username'], r['email'])),
but keep getting TypeError: <lambda>() takes exactly 1 argument (0
given) error
Thanks
On Apr 28, 7:01 pm, mdipierro <[email protected]> wrote:
> Much simpler.
>
> Field('access_key',calulate=lambda r: calculateValue(r['email']))
>
> and it will be automatic
>
> On Apr 28, 2:26 am, Rohan <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I have added a new column access_key in auth_user table, I want to
> > default it to with a value obtained by using email
>
> > calculateValue(email):
> > #some logic
> > return calculatedValue
>
> > I tried calling the above method using Field('access_key', 'string',
> > readable=False, writable=False, default=calculateValue(email)) but not
> > able to get the email.
>
> > also I tried fetching email in method itself but since auth_user table
> > is not yet defined, I was not able to access it. Any pointers how do I
> > default the value ?
>
> > calculateValue():
> > #fetch email
> > #some logic
> > return calculatedValue
>
> > I am creating a session usinghttp://codepad.org/tadGosTdso
> > calculateValue(form) is not called after session is created
> > auth.settings.login_onaccept = calculateValue
>
> > any help will be highly appreciated.