Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread And Clover
On 07/14/2010 06:43 AM, Ian Bicking wrote: There's only a couple tricky keys: SCRIPT_NAME, PATH_INFO, and HTTP_COOKIE. (And of those, PATH_INFO is the only one that really matters, in that no-one really uses non-ASCII script filenames, and non-ASCII characters in Cookie/Set-Cookie are still

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Friday, July 16, 2010, And Clover wrote: > On 07/14/2010 06:43 AM, Ian Bicking wrote: > > > There's only a couple tricky keys: SCRIPT_NAME, PATH_INFO, > and HTTP_COOKIE. > > > (And of those, PATH_INFO is the only one that really matters, in that no-one > really uses non-ASCII script filenames,

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread And Clover
On 07/16/2010 12:07 PM, Graham Dumpleton wrote: If you do that, one has to ask the question, given it is more convention than anything, why it isn't just a x-wsgiorg extension specification Yes, fine by me either way. I just want to be able to say "this application can use Unicode paths when

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 4:33 AM, And Clover wrote: > On 07/14/2010 06:43 AM, Ian Bicking wrote: > > There's only a couple tricky keys: SCRIPT_NAME, PATH_INFO, >> and HTTP_COOKIE. >> > > (And of those, PATH_INFO is the only one that really matters, in that > no-one really uses non-ASCII script fi

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Chris McDonough
On Fri, 2010-07-16 at 11:07 -0500, Ian Bicking wrote: > And this doesn't help with Python 3: either we have byte values of > SCRIPT_NAME and PATH_INFO in Python 3, or we have text values. I > think bytes will be more awkward to port to than text, and > inconsistent with other WSGI values. If we

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 12:28 PM, Chris McDonough wrote: > On Fri, 2010-07-16 at 11:07 -0500, Ian Bicking wrote: > > > And this doesn't help with Python 3: either we have byte values of > > SCRIPT_NAME and PATH_INFO in Python 3, or we have text values. I > > think bytes will be more awkward to p

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread P.J. Eby
At 11:07 AM 7/16/2010 -0500, Ian Bicking wrote: And this doesn't help with Python 3: either we have byte values of SCRIPT_NAME and PATH_INFO in Python 3, or we have text values. I think bytes will be more awkward to port to than text, and inconsistent with other WSGI values. OTOH, it has th

[Web-SIG] Unicode fundamentals

2010-07-16 Thread travis+ml-python-web
BTW, if you're a noob like me and can't follow the Unicode stuff, I once read this: http://www.joelonsoftware.com/articles/Unicode.html I need to read it again before commenting, but I seem to recall it being edifying, if not particularly memorable. ;-) -- A Weapon of Mass Construction My emails

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Stephan Richter
On Friday, July 16, 2010, Ian Bicking wrote: > We could make everything bytes and be done with it, but it would make it > much harder to port Python 2 WSGI code to Python 3. I think this might be best having seen all of the discussion. One could easily write a compatibility middleware that makes

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Gustavo Narea
Hello, Ian said: > Having two ways of expressing the same information will lead to bugs > related to which data is canonical. If an application is using > SCRIPT_NAME/PATH_INFO and then updates those values in any way, and > wsgi.raw_script_name/wsgi.raw_path_info are present, then there will be

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 1:40 PM, P.J. Eby wrote: > At 11:07 AM 7/16/2010 -0500, Ian Bicking wrote: > >> And this doesn't help with Python 3: either we have byte values of >> SCRIPT_NAME and PATH_INFO in Python 3, or we have text values. I think >> bytes will be more awkward to port to than text

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Gustavo Narea
Gustavo said: > - On ingress, if the charset is not specified in the request, it will > assume it's the one used by the other application, and thus it will > convert the request using the charset supported by the wrapped > application. That should actually be: "On ingress, if the charset in wsg

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 P.J. Eby wrote: > (Hm. Although actually, I suppose we *could* just borrow the time > machine and pretend that WSGI called for "byte-strings everywhere" > all along...) I like the idea of pushing responsibility for decoding stuff into the framewor

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ian Bicking wrote: >> IOW, the bytes/string discussion on Python-dev has kind of led me to >> realize that we might just as well make the *entire* stack bytes (incoming >> and outgoing headers *and* streams), and rewrite that bit in PEP 333 about >> u

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 4:47 PM, Tres Seaver wrote: > > Basically all the internal strings are textish, so we're left with: > > What do you mean by "internal"? Anything in the headers or the CGI > environment is intrinsically "bytes-ish" to me. Do you mean that you > want application programme

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Chris McDonough
On Fri, 2010-07-16 at 17:47 -0400, Tres Seaver wrote: > > In the past when we've gotten down to specifics, the only holdup has been > > SCRIPT_NAME/PATH_INFO, hence my suggestion to eliminate those. > > I think I favor PJE's suggestion: let WSGI deal only in bytes. I'd prefer that WSGI 2 was de

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 5:08 PM, Chris McDonough wrote: > On Fri, 2010-07-16 at 17:47 -0400, Tres Seaver wrote: > > > > In the past when we've gotten down to specifics, the only holdup has > been > > > SCRIPT_NAME/PATH_INFO, hence my suggestion to eliminate those. > > > > I think I favor PJE's su

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 5:06 PM, Ian Bicking wrote: > On Fri, Jul 16, 2010 at 4:47 PM, Tres Seaver wrote: > >> > Basically all the internal strings are textish, so we're left with: >> >> What do you mean by "internal"? Anything in the headers or the CGI >> environment is intrinsically "bytes-is

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Chris McDonough
On Fri, 2010-07-16 at 17:11 -0500, Ian Bicking wrote: > On Fri, Jul 16, 2010 at 5:08 PM, Chris McDonough > wrote: > On Fri, 2010-07-16 at 17:47 -0400, Tres Seaver wrote: > > > > In the past when we've gotten down to specifics, the only > holdup has been > >

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread P.J. Eby
At 02:28 PM 7/16/2010 -0500, Ian Bicking wrote: On Fri, Jul 16, 2010 at 1:40 PM, P.J. Eby <p...@telecommunity.com> wrote: At 11:07 AM 7/16/2010 -0500, Ian Bicking wrote: And this doesn't help with Python 3: either we have byte values of SCRIPT_NAME and PATH_INFO i

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread P.J. Eby
At 05:42 PM 7/16/2010 -0400, Tres Seaver wrote: P.J. Eby wrote: > (Hm. Although actually, I suppose we *could* just borrow the time > machine and pretend that WSGI called for "byte-strings everywhere" > all along...) I like the idea of pushing responsibility for decoding stuff into the framewo

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread P.J. Eby
At 07:20 PM 7/16/2010 -0400, Chris McDonough wrote: I'd much rather say be able to say: """ The PATH_INFO environment variable is a ``bytes-with-benefits`` type. To decode it: - First, split it on slashes:: segments = PATH_INFO.split('/') - Then, de-encode each segment's urlencoded portio

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Armin Ronacher
Hi, On 7/17/10 1:20 AM, Chris McDonough wrote: > Let me know if I'm missing something. The only thing you miss is that the bytes type of Python 3 is badly supported in the stdlib (not an issue if we reimplement everything in our libraries, not an issue for me) and that the bytes type has no st

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 P.J. Eby wrote: > At 07:20 PM 7/16/2010 -0400, Chris McDonough wrote: >> I'd much rather say be able to say: >> >> """ >> The PATH_INFO environment variable is a ``bytes-with-benefits`` type. >> To decode it: >> >> - First, split it on slashes:: >> >>

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Chris McDonough
On Sat, 2010-07-17 at 01:33 +0200, Armin Ronacher wrote: > Hi, > > On 7/17/10 1:20 AM, Chris McDonough wrote: > > Let me know if I'm missing something. > The only thing you miss is that the bytes type of Python 3 is badly > supported in the stdlib (not an issue if we reimplement everything in >

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 6:20 PM, Chris McDonough wrote: > > What are the concrete problems you envision with text request headers, > > text (URL-quoted) path, and text response status and headers? > > Documentation is the main reason. For example, the documentation for > making sense of path_in

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 8:46 PM, Ian Bicking wrote: > So... before jumping to conclusions, what's the hard part with using text? > Oh, the one thing that will be silly is cookies, but they are totally nuts already. They can be parsed equally well as bytes or latin1, and best only transcoded aft

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Chris McDonough
On Fri, 2010-07-16 at 20:46 -0500, Ian Bicking wrote: > On Fri, Jul 16, 2010 at 6:20 PM, Chris McDonough > wrote: > > What are the concrete problems you envision with text > request headers, > > text (URL-quoted) path, and text response status and > headers? >

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Ian Bicking wrote: > On Fri, Jul 16, 2010 at 6:20 PM, Chris McDonough wrote: > > > >> What are the concrete problems you envision with text request headers, >> text (URL-quoted) path, and text response status and headers? > > Documentation is the main reason.  For exam

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 11:28 PM, Graham Dumpleton < graham.dumple...@gmail.com> wrote: > > Nah, not nearly that hard: > > > > path_info = > urllib.parse.unquote_to_bytes(environ['wsgi.raw_path_info']).decode('UTF-8') > > > > I don't see the problem? If you want to distinguish %2f from /, then >

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 9:43 PM, Chris McDonough wrote: > > Nah, not nearly that hard: > > > > path_info = > > > urllib.parse.unquote_to_bytes(environ['wsgi.raw_path_info']).decode('UTF-8') > > > > I don't see the problem? If you want to distinguish %2f from /, then > > you'll do it slightly dif

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Friday, July 16, 2010, And Clover wrote: > On 07/14/2010 06:43 AM, Ian Bicking wrote: > > > There's only a couple tricky keys: SCRIPT_NAME, PATH_INFO, > and HTTP_COOKIE. > > > (And of those, PATH_INFO is the only one that really matters, in that no-one > really uses non-ASCII script filenames,

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Ian Bicking wrote: > On Fri, Jul 16, 2010 at 4:33 AM, And Clover wrote: > > > On 07/14/2010 06:43 AM, Ian Bicking wrote: > > > There's only a couple tricky keys: SCRIPT_NAME, PATH_INFO, > and HTTP_COOKIE. > > > > (And of those, PATH_INFO is the only one that really mat

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Ian Bicking wrote: > On Fri, Jul 16, 2010 at 12:28 PM, Chris McDonough wrote: > > > On Fri, 2010-07-16 at 11:07 -0500, Ian Bicking wrote: > >> And this doesn't help with Python 3: either we have byte values of >> SCRIPT_NAME and PATH_INFO in Python 3, or we have text v

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Gustavo Narea wrote: > Hello, > > Ian said: >> Having two ways of expressing the same information will lead to bugs >> related to which data is canonical.  If an application is using >> SCRIPT_NAME/PATH_INFO and then updates those values in any way, and >> wsgi.raw_scri

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Ian Bicking wrote: > On Fri, Jul 16, 2010 at 1:40 PM, P.J. Eby wrote: > > > At 11:07 AM 7/16/2010 -0500, Ian Bicking wrote: > > And this doesn't help with Python 3: either we have byte values of > SCRIPT_NAME and PATH_INFO in Python 3, or we have text values.  I thin

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Graham Dumpleton wrote: > On Saturday, July 17, 2010, Ian Bicking wrote: >> On Fri, Jul 16, 2010 at 1:40 PM, P.J. Eby wrote: >> >> >> At 11:07 AM 7/16/2010 -0500, Ian Bicking wrote: >> >> And this doesn't help with Python 3: either we have byte values of >> SCRIPT_NA