Auth is a callable class, so auth() calls the __call__() 
method<http://code.google.com/p/web2py/source/browse/gluon/tools.py#1219>, 
which then looks at request.args(0) to discern the particular Auth function 
that was requested and then calls that function. In /default/user/register, 
"register" is in request.args(0), so Auth.__call__() ends up calling 
Auth.register().

If you want to do something special with the register action, then you'll 
need some conditional code in the user() function and/or the user.html view:

form = auth()
if request.args(0) == 'register':
   [special code to customize creation and/or processing of register form]

You could also create an entirely separate register function and call 
auth.register() directly rather than just calling auth().

Anthony

On Wednesday, December 5, 2012 3:45:32 PM UTC-5, pumplerod wrote:
>
> Getting my feet wetter, I've been reading about generating forms.  Very 
> cool stuff.  Before I break things too badly though I thought I'd ask:
>
> I see that when I create a new app, web2py automatically generates a user 
> view and user() function in the default.py file.
> All that does is return dict(form=auth())
>
> So when I goto default/user/register how exactly is that being processed?
>
> I have a table "Companies" and as a user registers I would like them to be 
> able to include information about their company and have that entered into 
> the Companies table not kept with the Auth_User table.  So I figured I 
> would create my own form that simply extended the basic registration 
> process for Auth().  But when I look at the def user() function and all it 
> does is return form=auth() I'm lost because it all seems like magic now.
>
> My sense is that the Auth structure is a well thought out piece of work 
> and I don't want to go about changing it.  Could anyone help enlighten me?
>

-- 



Reply via email to