Hi, Mike.
Routes's can map resource with parent_resource.
map.resource('incident', 'incidents')
map.resource('entry', 'entries',
parent_resource=dict(member_name='incident',
collection_name='incidents')
You get url such as below.
/incidents/100/entries/10
That url is given from helper with h.url_for('incident_entry',
incident_id=100, id=10)
and h.url_for('entry', id=10) gives "/entries/10".
Is it helpfull?
Bye.
2007/12/4, Mike Orr <[EMAIL PROTECTED]>:
>
> I'm trying to combine Routes's RESTful actions with numbered
> resources. So I have the following URLs:
>
> /section/1234 # View incident 1234, with the usual
> URL suffixes for REST actions.
> /section/1234/5678 # View entry 5678 from incident 1234, with
> REST actions.
>
> /section/incident/1234 should redirect to the vew incident page.
> /section/entry/1234 should redirect to the view entry page. (Yes,
> entry IDs are globally unique.)
>
> The reason for all this is it's convenient for the user to see both
> IDs in the URL and to have short URLs, but also allow the user to
> access an entry without knowing the incident ID.
>
> Route names should be "incident_view" etc, with just plain "incident"
> for the view page.
>
> Going the other way would also be acceptable, with /incident/1234 and
> /entry/1234 being the REST actions and /1234/5678 being secondary
> routes to them, as long as it can be accomplished without external
> redirects (user visible) or full subrequests (cluttering the access
> log). Is it possible to do an internal redirect; e.g., for one route
> to change the variables and then let it match another route?
>
> routes/mapper.py lists some arguments to Mapper.resource that look
> like they might do the trick but I'm having trouble putting it all
> together. I'm using the development version of Routes (with .dynamic
> etc methods). Is this all doable or am I asking for too much?
>
> --
> Mike Orr <[EMAIL PROTECTED]>
>
> >
>
--
/*
Atsushi Odagiri
http://aodag.blogspot.com
mailto:[EMAIL PROTECTED]
*/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---