Have you read the threads on WSGI 2? These issues are discussed at length, though they haven't been put into a spec.
The proposal that seemed to work best was to keep the environ as str (i.e., unicode in Python 3), and eliminate the problematic SCRIPT_NAME and PATH_INFO, replacing them with url-encoded values. Also I think everyone is okay with removing start_response. All text would be decoded as latin1 on Python 3 (which allows for transcoding; also most text is not unicode). The request and response body would remain bytes. On Tue, Nov 24, 2009 at 2:58 AM, Malthe Borch <mbo...@gmail.com> wrote: > 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/ianb%40colorstudy.com > -- Ian Bicking | http://blog.ianbicking.org | http://topplabs.org/civichacker
_______________________________________________ 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