On Aug 28, 2011, at 10:44 AM, Bruno Rocha wrote:

> Lets say I have a dict of all my controlers/actions
> 
> dict(default=['index','page'], account=['user','login','profile','logout'])
> 
> when requests any that are in the dict should be executed, normal.. but
> 
> if request anything that are not in the dict I want to pass it to a default 
> function, example:
> 
> myapp/default/index # default/index is in dict should run normally
> 
> myapp/jonathan # jonathan is not in dict, so should execute account/user and 
> pass 'jonathan' as request.args(0)
> 
> I can do it using routes on error, but it is not elegant.
> 
> is there a better way?
> 

Maybe... So per the above, you have

functions = dict(default=['index','page'], 
account=['user','login','profile','logout'])

If you also have:

default_controller = 'account'
default_function = dict(default='index', account='user')

...then it should work as you describe. The downside is that you have to make 
'account' the default controller, since you want myapp/jonathan to default to 
that controller. If you don't want that, then you might want to make a proxy 
'user' function in the 'default' controller that redirects or something to the 
real account/user.

Reply via email to