> On Mar 13, 2015, at 14:19 , Chris McDonough <[email protected]> wrote:
> 
>> […]
> 
> OK that's a different issue, yep.  It would be great if you could currently 
> do this:
> 
> @view_config(renderer='string')
> def myview(request):
>    request.response.content_type = 'text/html'
>    return '<html><body>Hi</body></body>'
> 
> But you can't.  It's a bit of a genuine bug that you can't due to the way the 
> string renderer operates, but I've never figured out a good way to fix it.  
> You can work around it currently by doing something like this:

Side note, there is an open bug for this on Github: 
https://github.com/Pylons/pyramid/issues/1344

The issue is that webob.Response has a default content type set to text/html, 
and it is set upon creation, so we can’t simply have the renderers check to see 
if a content type has been set or not, and text/html became the magic value 
that meant it’s the default content type.

One of the ideas I had was to instead of setting text/html upon creation was to 
set it right before the Response was sent to the WSGI, only if no content type 
had been set before then. This way all renderers would be expected to set the 
content type, unless the user had over ridden the content type.

Bert

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to