[Web-SIG] Future of WSGI

Sylvain Hellegouarch sh at defuze.org
Wed Nov 25 09:40:11 CET 2009


> 2009/11/25 Henry Precheur <henry at precheur.org>:
>> Please replace '...' with actual code or at least some description of
>> what it's doing. Lots of people have been trying to define a nice
>> interface for these objects for YEARS. People who know a great deal
>> about HTTP, and Python. And yet there's not a single implementation
>> that's widely accepted as the "best of breed".
>
> class Request(object):
>     def __init__(self, stream):
>          self.environ = read_headers_until_crlf(stream)
>          self.stream = stream
>
> These headers are then "general-header", "request-header",
> "entity-header". The stream is what remains.
>

Personally, I would favor the idea that WSGI2 specifies the way headers
should be mapped to object attributes (e.g. Content-Type would become
content_type) and then let duck typing magic happen rather than specifying
a class from which to inherit for instance.

Instead of a dictionary, you'd provide an object that maps headers and a
few other attributes accordingly.

But again, it's just wishful thinking ;)

- Sylvain
-- 
Sylvain Hellegouarch
http://www.defuze.org


More information about the Web-SIG mailing list