On Aug 9, 2010, at 10:25 PM, Thadeus Burgess wrote:

> Where is the documentation on how to use it?

I sent an email on the subject, and there are comments in routes.example.py.

Tomorrow I'll try to add some info to the book in time for Massimo's deadline. 
Hang on just a minute and I'll try to find the messsage ... a minute passes ... 
here we are:

1. If you don't explicitly invoke any of the new features, routing should 
behave identically to before. If you see any different, please let us know asap.

2. You can now have a routes.py in the top level folder of an application, and 
it will be used *instead* of the base routes.py. However, it's not enough to 
simply have the file there; you must inform the routing logic about it.

3. The way you inform the routing logic is with a new element in the base 
routes.py: routes_app. routes_app is processed identically to routes_in, but 
the output must be an app name (or nothing). routes_app is processed at the 
beginning of a request. If it produces an app name, and that app has an 
app-specific routes.py (that is, applications/appname/routes.py), then that 
routes.py is used instead of the base routes.py.

4. In an unrelated change, there are three other new elements in routes.py:

default_application = "init"
default_controller = "default"
default_function = "index"

Note that default_application doesn't interact with app-specfic routing, since 
it's used after rewrite has taken place. default_controller and 
default_function should normally be used only in an app-specific routes.py, 
because, in the base routes.py, they will apply to all apps *without* an 
app-specific routes.py. That would probably lead to confusion when running 
admin or examples; at the very least their defaults would break.

5. As usual, I suggest that when you edit routes.example.py to generate a new 
routes.py, you also edit the doctest at the end, and use it to verify that 
you're getting what you expect. To run the doctest, just do "python routes.py".

There's also a patch pending that logs all rewrite operations. MUCH too verbose 
for production work, but could be useful in diagnosing problems with routes.py. 
(I think there's a problem with logging in general, though, so some more 
changes may be necessary.)

It's largely untested, but I'll try to respond quickly to bug reports.

Reply via email to