[web2py] Re: What can cause some of my extra fields to be missing from auth.user?
I would simply add one line the book. Do you want to propose it? On Monday, 28 July 2014 10:51:49 UTC-5, Leonel Câmara wrote: > > I have found the problem. The extra fields weren't showing up because > auth.user uses the row stored in Session which didn't have these fields > yet, whereas db.auth_user[user_id] doesn't. Not sure how we should deal > with this, should auth invalidate all sessions if it detects a field > change, or maybe just document this in the book? > -- 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.
[web2py] Re: What can cause some of my extra fields to be missing from auth.user?
I have found the problem. The extra fields weren't showing up because auth.user uses the row stored in Session which didn't have these fields yet, whereas db.auth_user[user_id] doesn't. Not sure how we should deal with this, should auth invalidate all sessions if it detects a field change, or maybe just document this in the book? -- 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.
[web2py] Re: What can cause some of my extra fields to be missing from auth.user?
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 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.
[web2py] Re: What can cause some of my extra fields to be missing from auth.user?
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.
[web2py] Re: What can cause some of my extra fields to be missing from auth.user?
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.
[web2py] Re: What can cause some of my extra fields to be missing from auth.user?
Do you guys need an example application where this problems happens? -- 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.