Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#14755 closed (invalid)

Wsgi Error

Reported by: Adrian Ribao Owned by: nobody
Component: HTTP handling Version: dev
Severity: Keywords: wsgi input keyerror
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm testing a site with latest django trunk and latest development version of django-page-cms.

When I try to add a new page, I get this error:

File "path/env/src/django-page-cms/pages/http.py", line 21, in get_request_mock
    'HTTP_HOST': 'testhost',

File "path/env/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 137, in __init__
    if type(socket._fileobject) is type and isinstance(self.environ['wsgi.input'], socket._fileobject):

KeyError: 'wsgi.input'

Change History (7)

comment:1 by Keryn Knight <keryn@…>, 13 years ago

Possibly related to ticket #14602 which resulted in changeset [14453], looking at the erro raised and the lines involved.

comment:2 by Adrian Ribao, 13 years ago

I'm in [14677] and still not working.

comment:3 by Keryn Knight <keryn@…>, 13 years ago

In an effort to rule in or out certain configurations:

  • What environment is this being run under: runserver/apache/nginx/appengine etc?
  • Are you able to replicate the problem outside of django-page-cms?
  • Have you tried rolling back to an older django revision (or stable release) to see if the problem persists?

I apologise if these seem like trite questions, or obvious things to check, but the original ticket seems to have enough unknown variables to make testing the problem onerous.

in reply to:  3 comment:4 by Adrian Ribao, 13 years ago

Replying to Keryn Knight <keryn@kerynknight.com>:

In an effort to rule in or out certain configurations:

  • What environment is this being run under: runserver/apache/nginx/appengine etc?
  • Are you able to replicate the problem outside of django-page-cms?
  • Have you tried rolling back to an older django revision (or stable release) to see if the problem persists?

I apologise if these seem like trite questions, or obvious things to check, but the original ticket seems to have enough unknown variables to make testing the problem onerous.

I'm using Apache + modwsgi 2.5, and I wasn't able to replicate the problem outside django-page-cms.

It was working with the previous version, but I don't remember the revision.

I can't find the problem here. The enviroment says it's running in test mode using port 8000.

parth/env/src/django-page-cms/pages/http.py in get_request_mock
'HTTP_HOST': 'testhost', 

environ: {'HTTP_HOST': 'testhost', 'PATH_INFO': u'/', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': u'', 'SERVER_NAME': 'test', 'SERVER_PORT': '8000'}

comment:5 by Keryn Knight <keryn@…>, 13 years ago

Keywords: wsgi keyerror added; wski key removed

According to the svn log, beyond the change-set previously mentioned there's also [14494] & [14493]. Looking at them briefly, it seems like the regression tests in [14494] specifically provide the wsgi.input key in the environ dictionary, which is notably absent from the django-page-cms mock WSGIRequest I can see on github.

I'm not familiar enough with the WSGI code (or indeed the spec) to speak any further on the subject, but it may be well intentionally required now, in which case django-page-cms will need to catch up, and possibly the change needs to be documented (providing a note on backwards compatibility, if such is the case?)

Hopefully someone with more knowledge on the internals (russellm recently, by the looks of things) will get the opportunity to look at this.

comment:6 by Russell Keith-Magee, 13 years ago

Resolution: invalid
Status: newclosed

If django-page-cms is providing a mock of WSGIRequest and it doesn't provide wsgi.input, then it isn't a complete mock. PEP333 specifies that WSGI requests *must* provide a number of wsgi. environment variables, one of which is wsgi.input. Django's own test client demonstrates the minimum required set.

Closing this invalid, on the basis that it appears to be a problem in the django-page-cms test framework. If you can provide evidence to the contrary, feel free to reopen.

comment:7 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top