Any suggestions on how one can modify the content-type of a response when
using multiple @view_config decorators on the same view?
E.g.
@view_config(accept='text/html', renderer='html.pt', ...)
@view_config(accept='text/xml', renderer='xml.pt', ...)
@view_config(accept='application/json' renderer='json')
def aview(request):
return {'a':1]
On Tuesday, November 6, 2012 12:09:42 AM UTC, Chris McDonough wrote:
>
> On 11/05/2012 06:38 PM, Marten wrote:
> > Hello,
> >
> > I'm working with Jinja2 templates but the response always renders as
> > text/html.
> >
> > How can I change it to text/plain or text/xml for example on a specific
> > view? I don't want to write a new renderer for that. I know that I can
> > achieve this very cumbersome by getting the renderer, creating a
> > response object and defining content_type and body attributes then.
> >
> > Is there a simple way to do this, like specifying a
> > response_content_type attribute in the view_config?
>
> @view_config(renderer='foo.jinja2', ...)
> def aview(request):
> request.response.content_type = 'text/xml'
> return {'a':1}
>
>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.