Problem with wsgiref.headers.Headers

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Jan 17 17:47:54 CET 2010


En Fri, 15 Jan 2010 18:41:29 -0300, Phil <phily05 at gmail.com> escribió:

> 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.

You forgot to mention the Python version; the code works fine with 2.x,  
but fails in 3.1
r68205 [1] is the culprit, in response to issue #4718 [2]
The commit message says the changes were made to comply with  
http://www.wsgi.org/wsgi/Amendments_1.0 (basically, clarify  
str/unicode/bytes handling in Python 3.x). Either the documentation should  
be updated or the original behavior be maintained (meaning the original  
list contents could be altered); you probably should raise the question in  
the Web-SIG [3].

[1] http://svn.python.org/view?view=rev&revision=68205
[2] http://bugs.python.org/issue4718
[3] http://www.python.org/community/sigs/current/web-sig/

-- 
Gabriel Genellina




More information about the Python-list mailing list