On Jan 10, 2011, at 11:31 AM, pbreit wrote:
> As usual, there's more to it than I first imagined!
> 
> To overcome the issue of routes being overwritten with an update, could there 
> be a routes_default.py that ships with Web2py and can be overridden by 
> routes.py in the same directory? Not super important.

That's possible. The problem I see with it is that it changes the behavior 
(including URLs) of web2py for those users who are not using routes.py unless 
routes_default.py specifies exactly the same routing as not having a routes 
file at all. In which case, what's the point?

> 
> I envision something like (pseudocode):
> 
> In /web2py/routes.py:
> 
>     default_app = 'init', 'welcome'  # try init first, then welcome
>     default_controller = 'default'
>     default_function = 'index'
>     if exists(applications/*/routes.py)
>         use(applications/*/routes.py) # would override default 
> controller/function

That's basically the way it works.

> 
> But I guess hard-coding default routing in core can protect against accidents.
> 
> Domain-based routing does sound like it would be a good feature.
> 
> Do I understand correctly that regex and non-regex routing cannot be used at 
> same time? I'm guessing that's going to be a requested feature.
> 

That's true for now, anyway. Mixing them doesn't work because there ends up 
being redundant code in the base routes.py, and we have to know which one to 
use.

If there's a demand for it, I could probably add a regex capability to the new 
router. I'd need to think about that some.

Reply via email to