On 11/12/05, Ian Bicking <[EMAIL PROTECTED]> wrote:
> Routes can match things at different points in the URL path, e.g., match
> a variable length string at the beginning of the path, and a specific
> string at the end.  Generally speaking, it matches the complete path at
> once, so there's lots of patterns that CherryPy doesn't really support,
> because you can only match one segment of a path in CherryPy.  Unless,
> of course, you use an ad hoc pattern.

You can do this using a default method and you have the entire
expressive power of Python to deal with how those types of URLs are
handled. For many common cases, there might be a bit more code than
what you'd have to do with Routes. But, the most common cases are
handled nicely by CherryPy's default resolution.

> Lastly, given a parsed path
> (which in CherryPy would probably mean a specific Python method) Routes
> can determine how you'd construct a path to get there.

True, this is something you can't do, generally, with CherryPy.
TurboGears does go as far as keeping track of where an application
root is so that absolute URLs can be rationally constructed for an
app.

> Oh, and I guess finally, you never have to change objects to attach
> other objects, which decreases the localization of the code (since
> parent objects must know about their children).

This one's more a matter of syntax. You can define a route that says
"/foo/bar/baz" maps to something or:

cherrypy.root.foo.bar.baz = NewBaz()

it's still only one line. If we were talking Java, we'd have to
configure the URLs independently.. but not with Python.

Someone has already done routes integration with CherryPy. I'd imagine
we can tailor it to fit TurboGears nicely. But, I don't want to bother
with that until someone comes along and says "I'm trying to do X and I
can't get it to work", or "I'm trying to do Y and it's a pain".

Kevin

Kevin

Reply via email to