Skip to content
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

Unexpected effect when omitting request from pyramid.renderers.render_to_response #248

Closed
dnouri opened this issue Aug 5, 2011 · 3 comments

Comments

@dnouri
Copy link
Member

dnouri commented Aug 5, 2011

It's probably convenient for some code paths to be able to leave out the request argument to pyramid.renderers.render_to_response. The docs carry as a sort of warning:

Supply a request parameter in order to provide the renderer with the most correct 'system' values (request and context in particular).

In my call to render, I didn't provide the request default argument, and was surprised to find out that writes to request.response attributes (such as request.response.content_type = 'foo') had no effect on the response produced by render_to_response.

I think either 1) the docs should be updated to be more clear about the consequences instead of "most correct system values", or ideally 2) the request argument to render_to_response be made required.

@mcdonc
Copy link
Member

mcdonc commented Aug 5, 2011

I don't think more words in the docs are going to help, but I'm fine with some being added.

We can't really make the request required, as people want to be able to render templates at module scope, where there is no request available.

I'm going to close this in a couple of days if no one volunteers to add words to the docs.

@cguardia
Copy link
Member

cguardia commented Aug 6, 2011

Added small explanation.

@cguardia cguardia closed this as completed Aug 6, 2011
@dnouri
Copy link
Member Author

dnouri commented Aug 6, 2011

Thanks.

Render templates at module scope, sure. But render them to response on a module level?

Not sure if I'm assuming correctly that only render_to_response is a problem here, and not render. If I'm correct, then it feels like request should be a required for that particular function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants