On Feb 17, 2011, at 11:54 AM, pbreit wrote:
> I'm still confused by routing.
> 
> 1) I see routers.example.py and routes.example.py. Which do I use? Should it 
> be named routers.py or routes.py? Do they work together? Which can be used at 
> the app level?

You choose one or the other, as routes.py.

Either can be used at the app level, though if you do so, you need a root 
routes.py as well.

With router.example.py, it's probably just as easy to put the app-specfic 
routing configuration(s) in the root router, though.

> 2) What would a routing file look like that matches the current default 
> routing behavior? I would much prefer to have explicit routing. I don't like 
> that routing is "off" be default.

"Routing" is perhaps a slightly misleading name. The default is to treat the 
first three elements of a URL as application/controller/function, to split the 
remaining path elements into request.args (a list), and to put the query string 
in request.vars (a dictionary).

If there are fewer than three elements in the URL, the URL is (effectively) 
filled out as required with /init/default/index.

The function of routes.py is to map the incoming URL to the above format, and 
vice versa for outgoing URLs.

> 3) I would think one of the most important and simplest use cases would be: 
> hide the default application name, hide "default" and hide "index". This 
> would be so that someone could role out one application on a server and have 
> clean, user-friendly URLs.

Yes.

> 4) Does the new routing functionality support mixed regex and non-regex?

No, though it's on the list for future enhancement.

Reply via email to