Auth() vs auth()

34 views
Skip to first unread message

Carlos Zenteno

unread,
Dec 18, 2013, 2:41:31 PM12/18/13
to web...@googlegroups.com
Newbee here...

I know that Auth() is the class in gluon
and it initial use:  auth = Auth(db)

But I have seen some uses like fom = auth()
in some controllers.

is there an auth() function besides the Auth() class?
where can I find this kind of stuff on my own?  THanks...

Anthony

unread,
Dec 18, 2013, 2:47:47 PM12/18/13
to web...@googlegroups.com
The Auth class has a __call__ method, which means Auth objects are callable. There's nothing special about the name "auth" -- it's just a convention. You could just as well do:

myauth = Auth(db)
myauth
()

When you call auth(), it checks request.args(0) to see which Auth action has been requested and then calls the appropriate method (which in many cases produces a form).

Anthony

Carlos Zenteno

unread,
Dec 18, 2013, 4:07:47 PM12/18/13
to web...@googlegroups.com
Thanks Anthony!
Very clear now....
Reply all
Reply to author
Forward
0 new messages