I disagree that the current 1.x track of the WSGI specification [1]
supports Python 3 in any reasonable way. Recently I suggested the
following rule as a guideline [2]:
Strings should be strings, chunks should be bytes.
What this really suggests is that everything that looks and feels like a
human-readable string (almost everything in HTTP except the input
content and the output response) should be a (unicode) string. As I read
the proposed 1.1 revision, this is not the case.
However, there is another fish to fry here too, and I'd like to propose
a new 2.x track altogether. In the outset, this would pertain to Python
3 only.
Instead of passing ``environ`` and violate its contract by adding
'wsgi.*' entries, we must pass in an object which actually represents
the HTTP request, e.g.
Request = namedtuple("Request", "environ input")
There could be other properties of this request-object. I haven't
considered the details.
To consider for this track is also the possibility of changing the
application call signature (I heard this proposal from Daniel Holth, but
it's probably been suggested before):
def __call__(self, request):
return status, headers, app_iter
I don't mind ``start_response`` terribly, but it's worth discussing.
Certainly returning this triple makes things easier.
\malthe
[1] http://bitbucket.org/ianb/wsgi-peps/src/tip/pep-0333.txt
[2] http://mockit.blogspot.com/2009/11/dont-look-back-in-anger.html
_______________________________________________
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