Thanks Anthony and Jonathan. It works!
It would be nice to have this routing documentation updated in the online
book.
On Monday, July 9, 2012 10:58:22 PM UTC+1, Jonathan Lundell wrote:
>
> On 9 Jul 2012, at 1:29 PM, Francisco Costa wrote:
>
> I'm using the Parameter-based system for routing
>
> In my routes.py I have this
>
> routers = dict(
>
> # base router
> BASE = dict(
> applications = ['admin', 'app', 'blog'],
> default_application = 'app',
> map_hyphen = True,
> domains = {
> 'blog.domain.com' : 'blog',
> 'domain.com' : 'app'
> },
> ),
> app = dict(
> controllers = ['default', 'user'],
> functions = ['index', 'show', 'list'],
> default_controller = 'default',
> default_function = dict(default='index', user='show')
> ),
> blog = dict(
> default_controller = 'default',
> ),
> )
>
>
> When I go to http://localhost/user/john i get this: "invalid function
> (user/john)"
>
> I would like it to map it to http://localhost/user/show/john
>
> So it is possible to pass args to a default function in a non default
> controller without the name of the function?
>
>
> Try specifying functions as a dict of lists keyed by controller names, and
> include and entry for user. Something like
>
> app = dict(
> ...
> functions = dict(
> default = [ list of functions],
> user = [ list of functions ],
> ).
> ...
>
> One other thing to pay attention to is that by default there's a function
> app/default/user that manages your auth object. The router will do the
> right thing, but there may be some omissions that it won't be able to do
> because the conflict creates an ambiguity. In particular, the router can
> normally shorten /app/default/user/whatever to /user/whatever, but it can't
> do that if you have a function named user.
>
> You can work around that by renaming your controller, or by renaming the
> auth-support function and telling Auth: auth = Auth(...
> function='somethingotherthanuser'...)
>