On Mon, 2012-01-09 at 13:51 -0800, Martin Aspeli wrote:
> Hi,
> 
> I have a hybrid traversal use case with a route like:
> 
>     config.add_route('api', '/api/*traverse')
> 
> I'd like to be able to generate a URL to a traversed-to resource, but
> request.resource_url() and request.route_url() don't work. I can do
> this:
> 
>     def api_resource_path(context, request):
>         return
> request.current_route_path(traverse=urllib.unquote(resource_path(context)
> [1:]))
> 
> That seems quite cumbersome, though. Is there a better API?

No, I'm afraid not.  You could maybe work around the edges by something
like doing:

  from pyramid.traversal import resource_path_tuple
  request.current_route_path(traverse=resource_path_tuple(context)[1:])

- C


-- 
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.

Reply via email to