[Web-SIG] Re: Latest WSGI Draft (Phillip J. Eby)

Ian Bicking ianb at colorstudy.com
Wed Aug 25 18:05:52 CEST 2004

tony at lownds.com wrote:
> It's a nice idea, and it would probably simplify both server and
> application code
> and the spec. But, it forces an implementation. I think inclusion in the
> PEP as a possible
> change before 1.0, will give the idea plenty of discussion time.

I agree, I don't think this need to be resolved before making it an 
official PEP.

>>     from email.Message import Message
>>     def application(env, start):
>>         headers = Message()
>>         headers.set_type("text/plain")
>>         headers.add_header("Set-Cookie", "CUSTOMER=WILE_E_COYOTE",
>>         start("200 OK", headers)("Hello world!")
> Just call the items() method, and WSGI remains the same
>           start("200 OK", headers.items())("Hello world!")
>>One of the nice things about it is that it makes it easier to do MIME and
>>HTTP headers that have parameter info.
> One issue: after the m.set_type call, an extra MIME-Version: 1.0 header is
> present.
> According to the HTTP 1.1 spec, when that header is present, whatever the
> server sends must be in "full compliance" with the MIME protocol. From
> reading the MIME spec, I guess adding Content-transfer-encoding: binary
> would take care of that...

Is it only after set_type then, not add_header('content-type',...)? 
Adding that header implicitly is rather annoying.

It's too bad there's not a simpler superclass to email.Message that 
implements just the header part, and not the email/MIME part.

Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org

More information about the Web-SIG mailing list