>
> in .9.6 setting headers like this worked:
> response.headers['Content-Type'] = 'application/ms-excel'
>
> in .9.7 , anything i do to them is met with this
> AttributeError: You cannot access Response.unicode_body unless charset
> is set
Response actually determines the charset value lazily via the Content-
Type header -- since you didn't specify one its value was reset.
response.content_type is the smarter, shorthand version, that
maintains the charset.
It looks like the old Response actually had the same behavior, it was
just less strict about returning unicode values when there was no
charset. Also, assuming you returned the result of a render call --
render returns unicode now whereas before it returned a raw str.
Since there's a few things involved here I don't think we can make it
seamlessly backwards compatible. This would also work:
response.headers['Content-Type'] = 'application/ms-excel; charset=%s'
response.charset
But this is obviously nicer:
response.content_type = 'application/ms-excel'
Apparently Response allows assignment of arbitrary attributes, so even
though it doesn't support content_disposition, it didn't fail. I have
no idea why it does this, I'd rather it fail fast. We'll have to ask
Ian.
I've added actual .content_disposition support to WebOb trunk.
--
Philip Jenvey
>
> so basically we mostly just need a docs change to the 'migrating to
> 0.9.7' instructions
Ok, done. Feel free to add to my change:
http://wiki.pylonshq.com/pages/diffpages.action?pageId=11174779&originalId=15302939
--
Philip Jenvey