Problem with wsgiref.headers.Headers

Phil phily05 at gmail.com
Fri Jan 15 16:41:29 EST 2010


I am having an issue with wsgiref.headers.Headers.

For example, if I do this...

from wsgiref.headers import Headers
list = []
wrapper = Headers(list)
wrapper['content-type'] = "text/html"
print(list)
print(wrapper)

I get an empty list printed, and then the correct result for wrapper
printed.

Am I misunderstanding the documentation?

class wsgiref.headers.Headers(headers)
Create a mapping-like object wrapping headers, which must be a list of
header name/value tuples as described in PEP 333. Any changes made to
the new Headers object will directly update the headers list it was
created with.

Thanks for any help,

Phil



More information about the Python-list mailing list