Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-10 Thread Ian Bicking
On Sun, Jan 9, 2011 at 1:47 AM, Stephen J. Turnbull step...@xemacs.orgwrote: Robert Brewer writes: Python 3.1 was released June 27th, 2009. We're coming up faster on the two-year period than we seem to be on a revised WSGI spec. Maybe we should shoot for a bytes of a known encoding

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-10 Thread Michael Foord
On 10/01/2011 17:24, Ian Bicking wrote: On Sun, Jan 9, 2011 at 1:47 AM, Stephen J. Turnbull step...@xemacs.org mailto:step...@xemacs.org wrote: Robert Brewer writes: Python 3.1 was released June 27th, 2009. We're coming up faster on the two-year period than we seem to be on

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-10 Thread Nick Coghlan
On Tue, Jan 11, 2011 at 3:24 AM, Ian Bicking i...@colorstudy.com wrote: The kind of object PJE was referring to is more like Ruby's strings, which do not embed the encoding inside the bytes themselves but have the encoding as a kind of annotation on the bytes, and do lazy transcoding when

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-10 Thread Stephen J. Turnbull
Ian Bicking writes: On Sun, Jan 9, 2011 at 1:47 AM, Stephen J. Turnbull step...@xemacs.orgwrote: Robert Brewer writes: Python 3.1 was released June 27th, 2009. We're coming up faster on the two-year period than we seem to be on a revised WSGI spec. Maybe we should

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-08 Thread Stephen J. Turnbull
Robert Brewer writes: Python 3.1 was released June 27th, 2009. We're coming up faster on the two-year period than we seem to be on a revised WSGI spec. Maybe we should shoot for a bytes of a known encoding type first. You have one. It's called ISO 2022: Information processing -- ISO 7-bit

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread And Clover
On Tue, 2011-01-04 at 03:44 +0100, Victor Stinner wrote: What is this horrible encoding bytes-as-unicode? It is a unicode string decoded from bytes using ISO-8859-1. ISO-8859-1 is the encoding specified by the HTTP RFC, as well as having the happy property of preserving every input byte.

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Victor Stinner
Le jeudi 06 janvier 2011 à 23:50 +, And Clover a écrit : On Tue, 2011-01-04 at 03:44 +0100, Victor Stinner wrote: What is this horrible encoding bytes-as-unicode? It is a unicode string decoded from bytes using ISO-8859-1. ISO-8859-1 is the encoding specified by the HTTP RFC, as well as

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Stephen J. Turnbull
Victor Stinner writes: It doesn't work and so something has to be changed. What specific bug have you observed? Everybody hates this hack, or at the very least is somewhat embarrassed by it, but the working group clearly believes that it works and something like it is necessary. They've

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Nick Coghlan
On Fri, Jan 7, 2011 at 9:51 PM, Victor Stinner victor.stin...@haypocalc.com wrote: On POSIX, the current code looks like that:  a) the OS pass a bytes environ to the program  b) Python decodes environ from the locale encoding  c) wsgi.read_environ() encodes environ to the locale encoding to

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread James Y Knight
On Jan 7, 2011, at 6:51 AM, Victor Stinner wrote: I don't understand why you are attached to this horrible hack (bytes-in-unicode). It introduces more work and more confusing than using raw bytes unchanged. It doesn't work and so something has to be changed. It's gross but it does work.

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread P.J. Eby
At 09:43 AM 1/7/2011 -0500, James Y Knight wrote: On Jan 7, 2011, at 6:51 AM, Victor Stinner wrote: I don't understand why you are attached to this horrible hack (bytes-in-unicode). It introduces more work and more confusing than using raw bytes unchanged. It doesn't work and so something

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Robert Brewer
P.J. Eby wrote: At 09:43 AM 1/7/2011 -0500, James Y Knight wrote: On Jan 7, 2011, at 6:51 AM, Victor Stinner wrote: I don't understand why you are attached to this horrible hack (bytes-in-unicode). It introduces more work and more confusing than using raw bytes unchanged. It

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Paul Moore
On 7 January 2011 18:36, Robert Brewer fuman...@aminus.org wrote: Still looking forward to the day when that moratorium is lifted. Anyone have any idea when that will be? See PEP 3003 (http://www.python.org/dev/peps/pep-3003/) - Python 3.3 is expected to be post-moratorium. Paul.

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Bill Janssen
P.J. Eby p...@telecommunity.com wrote: Right. Also, it should be mentioned that none of this would be necessary if we could've gotten a bytes of a known encoding type. Indeed! Or even string using a known encoding... If you look back to the last big Python-Dev discussion on bytes/unicode

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Robert Brewer
Paul Moore wrote: Robert Brewer fuman...@aminus.org wrote: P.J. Eby wrote: Also, it should be mentioned that none of this would be necessary if we could've gotten a bytes of a known encoding type. Still looking forward to the day when that moratorium is lifted. Anyone have any

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-07 Thread Nick Coghlan
On Sat, Jan 8, 2011 at 6:16 AM, Robert Brewer fuman...@aminus.org wrote: Python 3.1 was released June 27th, 2009. We're coming up faster on the two-year period than we seem to be on a revised WSGI spec. Maybe we should shoot for a bytes of a known encoding type first. There were a few minor*

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-06 Thread And Clover
On Tue, 2011-01-04 at 03:44 +0100, Victor Stinner wrote: What is this horrible encoding bytes-as-unicode? It is a unicode string decoded from bytes using ISO-8859-1. ISO-8859-1 is the encoding specified by the HTTP RFC, as well as having the happy property of preserving every input byte. PEP

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-06 Thread Raymond Hettinger
Can you please take a look at http://docs.python.org/dev/whatsnew/3.2.html#pep--python-web-server-gateway-interface-v1-0-1 to see if it accurately recaps the resolution of the WSGI text/bytes issues. I would appreciate any feedback, as it is likely that the whatsnew document will be most

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-06 Thread Glenn Linderman
On 1/6/2011 3:50 PM, And Clover wrote: ISO-8859-1 is the encoding specified by the HTTP RFC Please could I have the reference to that specification? I only recall ASCII and UTF-8 in my readings of various things HTTP and HTML, for headers, and form data. Naturally data pages can have any

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-06 Thread James Y Knight
On Jan 6, 2011, at 8:16 PM, Glenn Linderman wrote: On 1/6/2011 3:50 PM, And Clover wrote: ISO-8859-1 is the encoding specified by the HTTP RFC Please could I have the reference to that specification? I only recall ASCII and UTF-8 in my readings of various things HTTP and HTML, for

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-06 Thread Stephen J. Turnbull
Glenn Linderman writes: On 1/6/2011 3:50 PM, And Clover wrote: ISO-8859-1 is the encoding specified by the HTTP RFC Please could I have the reference to that specification? RFC 2616 (probably obsolete by now, but IRC ISO 8859/1 is already there IIRC), and I don't think UTF-8 is the

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-06 Thread Glenn Linderman
On 1/6/2011 7:37 PM, Stephen J. Turnbull wrote: Glenn Linderman writes: On 1/6/2011 3:50 PM, And Clover wrote: ISO-8859-1 is the encoding specified by the HTTP RFC Please could I have the reference to that specification? RFC 2616 (probably obsolete by now, but IRC ISO 8859/1 is

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-06 Thread P.J. Eby
At 04:00 PM 1/6/2011 -0800, Raymond Hettinger wrote: Can you please take a look at http://docs.python.org/dev/whatsnew/3.2.html#pep--python-web-server-gateway-interface-v1-0-1http://docs.python.org/dev/whatsnew/3.2.html#pep--python-web-server-gateway-interface-v1-0-1 to see if it

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Antoine Pitrou
On Tue, 04 Jan 2011 03:44:53 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: def wsgi_string(u): # Convert an environment variable to a WSGI bytes-as-unicode string return u.encode(enc, esc).decode('iso-8859-1') def run_with_cgi(application): environ = {k:

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Victor Stinner
Le mardi 04 janvier 2011 à 13:20 +0100, Antoine Pitrou a écrit : On Tue, 04 Jan 2011 03:44:53 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: def wsgi_string(u): # Convert an environment variable to a WSGI bytes-as-unicode string return u.encode(enc,

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Antoine Pitrou
On Tue, 04 Jan 2011 14:33:37 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: Le mardi 04 janvier 2011 à 13:20 +0100, Antoine Pitrou a écrit : On Tue, 04 Jan 2011 03:44:53 +0100 Victor Stinner victor.stin...@haypocalc.com wrote: def wsgi_string(u): # Convert an environment

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/03/2011 09:44 PM, Victor Stinner wrote: Hi, In the PEP , I read: -- import os, sys enc, esc = sys.getfilesystemencoding(), 'surrogateescape' def wsgi_string(u): # Convert an environment variable to a WSGI

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread P.J. Eby
At 03:44 AM 1/4/2011 +0100, Victor Stinner wrote: Hi, In the PEP , I read: -- import os, sys enc, esc = sys.getfilesystemencoding(), 'surrogateescape' def wsgi_string(u): # Convert an environment variable to a WSGI bytes-as-unicode string return u.encode(enc,

Re: [Python-Dev] PEP 3333: wsgi_string() function

2011-01-04 Thread Guido van Rossum
On Tue, Jan 4, 2011 at 8:22 AM, Tres Seaver tsea...@palladion.com wrote: Note that Guido just recently wrote on that list that he considers that PEP to be de facto accepted. That was conditional on there not being any objections in the next 24 hours. There have been plenty, so I'm retracting

[Python-Dev] PEP 3333: wsgi_string() function

2011-01-03 Thread Victor Stinner
Hi, In the PEP , I read: -- import os, sys enc, esc = sys.getfilesystemencoding(), 'surrogateescape' def wsgi_string(u): # Convert an environment variable to a WSGI bytes-as-unicode string return u.encode(enc, esc).decode('iso-8859-1') def run_with_cgi(application):