>
> Where would I add these?
>

Add the links wherever you want them in your user interface.
 

> I am really mystified how the auth() class call receives the method as 
> its argument from these urls assuming that the user action looks like: 
>
> def user() 
>    return dict(form=auth()) 
>

Auth is a callable class, so when you call auth(), you are calling the 
Auth.__call__ method. That method checks to see if request.args[0] is among 
the set of supported Auth methods, and if so, it calls the associated 
method via:

return getattr(self, args[0])()

So, the __call__ method essentially acts as a router to the other Auth 
methods. Of course, you can also call those methods directly rather than 
relying on request.args and the __call__ router.
 

> I am really mystified about how one can index the request.args using 
> parens instead of square braces? 
>
> as in: 
>
>  <h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2> 
>

request.args is a storage.List object, which acts like a regular Python 
list but is also callable (i.e., it has a __call__ method). You can call it 
with an index, and it will return the same value as if you had indexed via 
the brackets syntax. The only difference is if you call it with an invalid 
index, instead of throwing an exception, it simply returns None. So, let's 
say request.args is an empty list -- in that case, request.args(0) is None, 
but request.args[0] will result in the following error: "IndexError: list 
index out of range". This allows you to do things like passing 
request.args(0) as a value without first having to check whether it exists.

Anthony

Reply via email to