On Friday, April 20, 2012 6:28:45 PM UTC-4, cyan wrote:
>
>
> The new user id should be in form.vars.id as well as session.auth.user.id at 
>> that point.
>
>
> Thanks Anthony. But is this documented anywhere in the manual or in any 
> doc of Web2py? Otherwise, it is really difficult for users to figure this 
> out without consulting experts like you.


Well, there's a register_onaccept example in the book that gets the new 
user id from form.vars.id: 
http://web2py.com/books/default/chapter/29/9#Authorization-and-CRUD. But I 
agree that usage of the Auth callbacks could be better documented. We're 
waiting for Massimo to make the online book editable so a few of us can go 
in and make corrections and additions like this. Hopefully that will happen 
soon.

In the meantime, it's often helpful to look directly at the code. For 
example, in the Auth register() function, here is where you can see the id 
can be found in form.vars.id: 
http://code.google.com/p/web2py/source/browse/gluon/tools.py#2022. And here 
is where you can see that the user record is stored in session.auth: 
http://code.google.com/p/web2py/source/browse/gluon/tools.py#2051. Once you 
start to get to know the code, it's usually fairly quick and easy to figure 
out these kinds of things.

Anthony

Reply via email to