Issue71

Title repoze.who has problems with generator wsgi applications.
Priority critical Status resolved
Superseder Nosy List chrism, douglas
Assigned To chrism Topics

Created on 2009-04-18.21:00:53 by douglas, last changed 2009-04-23.23:43:16 by chrism.

Files
File name Uploaded Type Edit Remove
issue71.diff douglas, 2009-04-23.20:09:03 application/octet-stream
Messages
msg179 (view) Author: chrism Date: 2009-04-23.23:43:16
This patch was placed into 1.0.13, which I just released to PyPI (and to our
internal "lemonade" index).  Thanks again.
msg178 (view) Author: chrism Date: 2009-04-23.23:26:56
Thank you for the patch!

It appears that every piece of middleware I've ever written is broken in the
same way.

I'll apply this and make a new release after I write tests for your
wrap_generator function and the bit that calls it.  If you have tests, don't be
shy about committing them. ;-)
msg177 (view) Author: douglas Date: 2009-04-23.20:09:03
As repoze.who fails to handle the WSGI spec, and I'm supplying a working patch,
I'm bumping up the priority...
msg176 (view) Author: douglas Date: 2009-04-23.17:34:29
This is a bug in repoze.who because of this paragraph in PEP 333:

(Note: the application must invoke the start_response() callable before the
iterable yields its first body string, so that the server can send the headers
before any body content. However, this invocation may be performed by the
iterable's first iteration, so servers must not assume that start_response() has
been called before they begin iterating over the iterable.)

I've got a wrapper working, I'll implement it into repoze.who and submit a patch
msg174 (view) Author: douglas Date: 2009-04-18.22:04:41
The only way I can think to fix this is to create a new generator that wraps the
previous one.  It calls the wrapped generator once, caches that, and then yields
that and any further responses.  This allows the original generator to behave
the way it did before, and repoze.who can take a look at the status code.
msg173 (view) Author: douglas Date: 2009-04-18.21:00:52
If a WSGI application returns a generator expression, then
default_challenge_decider in classifiers.py tries to call status.startswith,
which blows up because status has not yet been decided (since the generator
hasn't been called yet)
History
Date User Action Args
2009-04-23 23:43:16 chrism set status: chatting -> resolved
messages: + msg179
2009-04-23 23:26:56 chrism set assignedto: chrism
messages: + msg178
nosy: + chrism
2009-04-23 20:09:03 douglas set priority: bug -> critical
files: + issue71.diff
messages: + msg177
2009-04-23 17:34:30 douglas set messages: + msg176
2009-04-18 22:04:41 douglas set status: unread -> chatting
messages: + msg174
2009-04-18 21:00:53 douglas create