Thanks. This helps; some follow-ups below.

On Sat, Jun 11, 2011 at 1:52 PM, Michael Merickel <mmeri...@gmail.com>wrote:

> Using traversal you'll need to define your own __getitem__ on your
> context objects that is capable of discriminating your leaf nodes.
>

Sure, that makes sense, but then the view / render code needs to be inside
of the resource objects, not as @view_config decorators, and the simple
wrap-up-renderer way of doing it is gone. I'd have to generate and return a
response object within the model code, which I don't really fancy. Or am I
missing something?



> For example you can add a custom view predicate which will
> point the view lookup at the same (or different) view with a different
> renderer.
>
> def json_fmt(context, request):
>    if request.matchdict['ext'] == 'json': return True
>    return False
>
> config.add_route('test', '/test')
> config.add_route('test_fmt', '/test.{ext}')
>
> config.add_view(route_name='test', view='ms.views.test',
> renderer='test.mako')
> config.add_view(route_name='test_fmt', view='ms.views.test',
> custom_predicates=(json_fmt,), renderer='json')
>

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.

Can I keep traversal, keep using simple @view_config decorators, and have
file-extensions? Seems like no.

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

Reply via email to