On Fri, Jun 15, 2012 at 12:38:37PM -0700, Jason wrote: > > > On Friday, June 15, 2012 3:11:22 PM UTC-4, Theron Luhn wrote: > > > > A lot of times I use the same view for both editing items and making new > > items. How can I determine which view name is being called? I know I'm > > not explaining myself very well, so to talk in code: > > > > @view_config(context=Context, name='new', renderer='edit.pt') > >> @view_config(context=Context, name='edit', renderer='edit.pt') > >> def edit(context, request): > >> if [name is 'edit']: > >> #Load data to edit > >> elif [name is 'new']: > >> #Do something else > >> #Do more stuff > > > > > > > I believe it is available in request.matchdict['action'] -- at least if you > are using urldispatch.
Or, if you're using traversal (which looks to be the case in your example), the view name is in ``request.view_name``. http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/api/request.html#pyramid.request.Request.view_name -- 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.
