-
Notifications
You must be signed in to change notification settings - Fork 887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
response.content_type does not persist with render_to_response
if optional request
is omitted.
#1534
Comments
The Regardless, like @mcdonc said in #248, if you'd like to improve the docs you should feel free. There are 2 bugs I found while researching your issue though.
|
Suggest this language: |
I've opened #1536 as a direct complaint about this behavior. IMO the |
@stevepiercy works for me @mmerickel totally agree with you and #1536 . i looked into trying to patching that behavior, and saw some red flags so I recommended a docs change. the big issue is that this would likely create backwards incompatibilities with anyone who has build a custom render factory in accordance with the docs/tutorials. |
@jvanasco the only backward incompatibility would be if you expected the |
Yeah. I'll collect them into the other ticket. |
poke @jvanasco |
thanks for poking. totally forgot about this. i'll try to find the part I had an issue with tonight. |
#1563 is merged. |
This is the same underlying issue as described in #248, but with a different effect/gotcha.
I created a single file example here: https://gist.github.com/jvanasco/4a27eb95549de771b304
When returning the result of a
render_to_response
using one of the default renderers (i.e.json
), the "content-type" header is set on therequest.response
by the renderer function -- so it is not available to theResponse
if there is norequest
.This is weird. It's not doing what one would expect, and the
render_to_response
docs don't suggest that therequest
is required for this expected behavior (http://docs.pylonsproject.org/docs/pyramid/en/latest/api/renderers.html):It's not clear/expected from this text that one would need to submit a
request
attribute in order for the response configurations to actually be made. This is also misleading regarding the flow -- the expected change/configure of the "response" would not be made before calling the function, but within it.I think it's acceptable & best to explain this within the docs. Perhaps something like "Important: If you do not supply a
request
parameter, the renderer will not be able to set the appropriate content headers on the response."The text was updated successfully, but these errors were encountered: