Traversal and views

11 views
Skip to first unread message

Mike Orr

unread,
Dec 4, 2011, 9:11:45 PM12/4/11
to pylons-...@googlegroups.com
My main hesitation with using traversal is, how do I prevent views
from being accessed willy-nilly from any resource? The 'starter'
scaffold defines a static view and a home page view. Are these by
default accessible only as "/static" and "/"? Or if there's a resource
"/a/b/c/", would they also be accessible as "/a/bc/static" and
"/a/b/c"? I like tight restrictions, so that a resource can only
access a few certain views rather than any view. Do I have to
verbosely specify that for every resource type? Or can I be reassured
that a view won't be accessible from a resource type unless I
configure something?

--
Mike Orr <slugg...@gmail.com>

Chris Rossi

unread,
Dec 4, 2011, 9:18:51 PM12/4/11
to pylons-...@googlegroups.com

I typically specify a type for the context:

@view_config(name='edit', context='BlogPost', permission='edit')
def edit_blogpost_view(context, request):
etc....

That view will only get called if the resource is a BlogPost and the
view name is 'edit'.

Chris


> --
> Mike Orr <slugg...@gmail.com>
>
> --
> You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
> To post to this group, send email to pylons-...@googlegroups.com.
> To unsubscribe from this group, send email to pylons-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
>

Reply all
Reply to author
Forward
0 new messages