Message222005
Consider this paragraph of PEP3333, referring to headers obtained
via start_response, emphasis mine:
Instead, it must store them for the server or gateway to
transmit only after the first iteration of the application
return value that yields a *non-empty bytestring*, or upon
the application's first invocation of the write() callable.
This means that an WSGI app such as this should be valid, because the
yielded bytes pre-start_response are empty:
def application(environ, start_response):
yield b''
start_response("200 OK", [("Content-Type", "text/plain")])
yield b'Hello, World.\n'
However, in wsgiref's simple server, this fails:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/lib/python3.4/wsgiref/handlers.py", line 269, in write
raise AssertionError("write() before start_response()")
AssertionError: write() before start_response() |
|
Date |
User |
Action |
Args |
2014-07-01 03:15:10 | rschoon | set | recipients:
+ rschoon, pje |
2014-07-01 03:15:10 | rschoon | set | messageid: <1404184510.5.0.84615415722.issue21890@psf.upfronthosting.co.za> |
2014-07-01 03:15:10 | rschoon | link | issue21890 messages |
2014-07-01 03:15:09 | rschoon | create | |
|