[web2py] Re: Setting the default user id derived from a custom auth table in a record

2010-10-25 Thread mdipierro
There are only two possibilities: - you are not logged in - the code above is executed before auth=Auth() in db.py is executed (remember models are executed alphabetically) On Oct 24, 2:18 pm, Luther Goh Lu Feng wrote: > The snippet below defines a table that stores comments that are > create

[web2py] Re: Setting the default user id derived from a custom auth table in a record

2010-10-25 Thread ron_m
I think what is happening is the model is exec'd at the start of the request but if the user is not logged in yet or the session has expired forcing a trip to the login page, the model with get None because auth is not in the session. Once the trip to the login page completes it goes back to the co

[web2py] Re: Setting the default user id derived from a custom auth table in a record

2010-10-24 Thread annet
As far as I know auth.user.id should work. However, I faced a similar problem and solved it by setting the default in the function, something like: def add_comment(): db.comment.user.default=auth.user.id return dict(...) Maybe someone else can provide you (and me) with