On Jan 10, 2011, at 9:33 AM, Wikus van de Merwe wrote:
> I'm not using these routes. These were just made up examples to challenge the 
> proposed new routes. Now I understand that new routes are not intend to be 
> replacement for the old one, but rather a simplified alternative to handle 
> the most common needs.

Though by "most common" I mean "nearly all". If there's a real-world case that 
the new scheme doesn't handle, I'd like to know about it so that case can go on 
the list.

> 
> However, it looks still quite complicated for me. I never liked the fact that 
> application specific routes are global. I think it would be much more clear 
> if global routes would be used to map to applications only (both based on url 
> paths and domains) and the app-specific local routes would be used to map 
> paths to controllers/functions.

That's entirely up to the user. The reason I allow (not require) app-specific 
route to be defined in the base routes.py is that the router for applications 
like the stock welcome/admin/examples is exactly:

routers=dict(
        BASE = dict(),
        admin = dict(),
        examples = dict(),
        welcome = dict(),
)

or, more compactly:

routers = {}

...and it seemed like an undue burden to oblige the user to create three more 
routes.py files for that. Nonetheless, you're free to do it if you want.


> I also support pbreit here saying it should be the default, that is web2py on 
> installation should have welcome and example apps with local routes. This 
> separation makes things easier to understand and manage.

I agree, except that I think it needs to be something like routes.standard.py, 
with the user copying it to routes.py. Otherwise, if the user customizes 
routes.py, it'll get overwritten at the next web2py update.

> 
> And answering your questions, I'm deploying my apps on GAE and I'm not using 
> domains. I'm using routes.py to simplify urls so that it is easier to 
> remember them or use in printed materials. For the rest I'm happy with the 
> default /controller/function dispatching.

In that case, with the new facility, all you need in routes.py is:

routers = {}

...if your default application is 'init'. Otherwise:

routers = dict(
    BASE = dict( default_application='myapp' )
)

...and you should get maximal URL simplification. (You can also specify 
default_controller and default_function if they're not default/index.)

Reply via email to