This works for me:

>>> from gluon.tools import Auth
>>> db = DAL()
>>> auth = Auth(db)
>>> auth.settings.extra_fields['auth_user'] = [Field('test',compute=lambda 
row: row.email)]
>>> auth.define_tables()
>>> 
db.auth_user.insert(email='massimo.dipie...@gmail.com',password=CRYPT()('test')[0])
1L
>>> user = db.auth_user[1]
>>> auth.login_user(user)
>>> auth.user
<Row {'first_name': '', 'last_name': '', 'registration_id': '', 'email': 
'massimo.dipie...@gmail.com', 'reset_password_key': '', 'test': 
'massimo.dipie...@gmail.com', 'registration_key': '', 'id': 1L}>




On Sunday, 27 July 2014 14:28:40 UTC-5, Anthony wrote:
>
> He's saying the value is there when viewing the record via 
> db.auth_user[auth.user_id] (so it has been computed) but it doesn't show up 
> in auth.user.
>
> On Sunday, July 27, 2014 12:17:09 PM UTC-4, Massimo Di Pierro wrote:
>>
>> The computed fields are missing if computation fails. Try pass a function 
>> to compute=myfunc and use a try except within the function to determine if 
>> the function is being called and if it fails.
>>
>> Normally it fails silently if a parameter required for the computation is 
>> missing.
>>
>> On Thursday, 24 July 2014 14:02:05 UTC-5, Leonel Câmara wrote:
>>>
>>> Stupid question time. What can cause some of my extra fields to be 
>>> missing from auth.user?
>>>
>>> They are only missing from auth.user if I do db.auth_user[auth.user_id] 
>>> the fields are there.
>>>
>>> Example of an extra field I have that doesn't show up in auth.user
>>>
>>> Field('cropped','upload', uploadseparate=True, readable=False, 
>>> writable=False, autodelete=True, compute=lambda row: SMARTHUMB('auth_user', 
>>> row.photo, (200, 200), name='cropped')),
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to