> 2009/11/25 Henry Precheur <he...@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 _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com