On Feb 19, 2011, at 9:18 PM, Ross Peoples wrote: > I figured out part of the problem. In the code above, it needs to be 'routers > =', not 'router ='. This works exactly like you mentioned it would. If you go > to /test, it expects to find a test() function in your default controller. In > my case, since this is going to be a WordPress-like application, I won't know > what pages will be defined ahead of time. So is there some kind of catch-all > function I can use in the default controller? > > If you go to /blog/the-post, I would expect to have to define a blog() > function, and return the content for the-post. But for pages that should be > on the root, like /about or /random-page, how would I catch this? I would > rather not have to do /page/about instead.
/about needs to be a function in the default controller. The problem is dealing with corner cases. If *every* URL is of the form /post-name, and *never* refers to an application, controller or function--that we can deal with (though you'd have to use the regex routes.py). But suppose you want to refer to a function /myapp/default/user with a URL /user in addition to post names: how do we distinguish the function 'user' from the post name 'user'? What happens when a post slug ends up being 'myapp'? The way routers works now is that the URL always contains at least a function. Consider that you don't have a completely open-ended list of such functions. /about can be a function, as can /user. If all blot-post slugs are accessed via /blog/slug, then what purpose is the catch-all serving? There's no pressing reason that every URL must be valid.

