On Jun 11, 3:02 pm, Matt Feifarek <matt.feifa...@gmail.com> wrote: > Sure, but we're not using traversal anymore now... we're hand-poking all of > this stuff. I like your solution, in a non-traversal situation.
Sorry, I gave this example because it's a better solution to the SO solution that you linked to, so I figured you were interested in how to do it with dispatch as well. > Can I keep traversal, keep using simple @view_config decorators, and have > file-extensions? Seems like no. How you use views with traversal is completely dependent on your resource tree. So assuming you have a tree for /users/matt and you want to handle a view named status off of the User('matt'), you could simply add a view for 'status' and a view for 'status.json': @view_config(name='status', context=User, renderer='status.mako') @view_config(name='status.json', context=User, renderer='json') def status_view(request): user = request.context return { 'key': 'value', # passed to the matched renderer } At least in the brief moment I've pondered this, you will have a problem matching a view in the case where there is no name. For example matching '/users/matt.json', as the User.__getitem__ will have to take care of that. You can probably argue that handling this url with that format wouldn't make sense anyway, however. Michael -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.