mark methods passed through wsgi META with do_not_call_in_templates #1546

Closed
wants to merge 4 commits into
from

Projects

None yet

4 participants

@ericbuehl

WSGI servers such as Werkzeug pass callable methods that should NOT be called when the META structure is printed in places such as the debug response handler. http://werkzeug.pocoo.org/docs/serving/#shutting-down-the-server

When a Django view throws an error (with DEBUG=True) and is hosted by Werkzeug, it causes the server to silently shut down because the Django error page is blindly calling the shutdown method in order to pretty print the result for the error page.

@timgraham
Django member

This also needs a ticket and test.

@jacobian
Django member

Hm. I'm not sure this is a such a good idea. It requires an iteration through META on every request, whether or not you're actually using Werkzeug. I don't like the idea of adding an overhead that everyone has to pay because of a side effect in the way Werkzeug works. I don't know that I have a better solution, but right now I'm -1 on merging this.

@ericbuehl

I agree that this is a bit wonky for Werkzeug to be passing a callabale in the environ dict, but it's unacceptable for Django to be blindly invoking that callable at any point. How about one of the following options:

a) iterate through the META structure only when DEBUG==True
b) delay iteration until we enter the debug handler view

My vote is for option b. Thoughts?

@apollo13
Django member

Since this has a -1 from jacob and clearly needs more discussion, please open a ticket and discuss there and then reopen a new pull request with the decided solution (if at all)

@apollo13 apollo13 closed this Sep 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment