On Mon, Nov 23, 2009 at 11:59:03AM -0800, Mike Orr wrote:
> The answer is to use a generic 'id' variable in the route, and to
> rename the variable in the action. This is the philosophy behind the
> default "/{controller}/{action}/{id}" route.
>
> map.connect("/api/{action}/{id}", controller="api")
I thought about doing something like this, but this will break
documentation generation: the parameters will all be generated in the
docs as "id". While I might be able to get over that, I have to
publish this API to programmers that will (fairly) get confused when
they see a funtion that takes an id, but the documentation claims it's
something like a name.
I guess I may have to live with a bunch of routes. That's not really
the end of the world, since I can write things like:
map.connect(r"/api/{action:get.*byid}/{id:[0-9]+}", controller="api")
map.connect(r"/api/{action:get.*byacct}/{acct:[0-9]+}", controller="api")
map.connect(r"/api/{action:get.*bystr}/{searchstr}", controller="api")
Ross
--
Ross Vandegrift
[email protected]
"If the fight gets hot, the songs get hotter. If the going gets tough,
the songs get tougher."
--Woody Guthrie
signature.asc
Description: Digital signature
