#view.py
from pyramid.events import subscriber
from pyramid.events import NewRequest
@subscriber(NewRequest)
def add_header(event):
response = event.request.response
response.headers.add('Content-type', 'text/html')
вторник, 6 ноября 2012 г., 5:38:55 UTC+6 пользователь Marten написал:
>
> 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?
>
> Kind regards
> Marten
>
--
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.