Skip to content

Conversation

@jmoldow
Copy link

@jmoldow jmoldow commented Feb 15, 2014

Fixes KeyError when indexing request.META if 'wsgi.multiprocess' is not
present. This was a bug in DebugToolbar.should_render_panels().

Also adds test cases for DebugToolbar.should_render_panels().

Fixes KeyError when indexing request.META if 'wsgi.multiprocess' is not
present. This was a bug in DebugToolbar.should_render_panels().

Also adds test cases for DebugToolbar.should_render_panels().
@aaugustin
Copy link
Contributor

PEP 3333 says:

In addition to the CGI-defined variables, the environ dictionary may also contain arbitrary operating-system "environment variables", and must contain the following WSGI-defined variables: (...) wsgi.multiprocess

If the variable isn't present, that's a bug in your WSGI server. What server are you using?

@jmoldow
Copy link
Author

jmoldow commented Feb 15, 2014

It is the server of a friend of mine, @uakfdotb, who was testing my pull request to upgrade our version of the debug toolbar [1]. I believe he was using some setup with Apache that did not include WSGI, though I don't know the details.

[1] learning-unlimited/ESP-Website#1034

@aaugustin
Copy link
Contributor

Oh, right, Django 1.4 still supports mod_python :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should default to True in order to enable the safe but inefficient behavior on non-WSGI servers.

@aaugustin
Copy link
Contributor

I appreciate the effort you put in writing the tests, but I'm not conviced they add that much value.

They're testing the implementation of should_render_panels. Any change in should_render_panels would result in a matching change in the tests. And they didn't catch the fact that your implementation returns the wrong value when wsgi.multiprocess isn't available...

Changes request.META['wsgi.multiprocess'] default to True. This is a
correction of 1783d19, so that the safe
but inefficient behavior of panel rendering is enabled on non-WSGI
servers.
@jmoldow
Copy link
Author

jmoldow commented Feb 15, 2014

I changed the default value.

test_should_render_panels_RENDER_PANELS_None_wsgi_multiprocess_None() does catch the problem, but it did not exist before we ran into the problem.

I can remove some of the other tests if you want.

@aaugustin aaugustin added the Bug label Feb 15, 2014
Updates
test_should_render_panels_RENDER_PANELS_None_wsgi_multiprocess_None() to
take into account the change in
ad50619.

Also removes unneeded tests of should_render_panel().
@aaugustin aaugustin closed this in 6ce52b2 Apr 19, 2014
aaugustin added a commit that referenced this pull request Oct 6, 2015
aaugustin added a commit that referenced this pull request Oct 6, 2015
aaugustin added a commit that referenced this pull request Oct 6, 2015
aaugustin added a commit that referenced this pull request Oct 6, 2015
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this pull request Oct 2, 2016
ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this pull request Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants