Hello, Mdipierro wrote "calculate=lambda..." not "default=lambda...."
(But I didn't try it even if I'm interested in the trick !) -Mathieu On Mon, May 3, 2010 at 14:29, Rohan <yourbuddyro...@gmail.com> wrote: > 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 <mdipie...@cs.depaul.edu> wrote: > > Much simpler. > > > > Field('access_key',calulate=lambda r: calculateValue(r['email'])) > > > > and it will be automatic > > > > On Apr 28, 2:26 am, Rohan <yourbuddyro...@gmail.com> 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. >