Re: [Web-SIG] WSGI for Python 3

2010-08-30 Thread P.J. Eby
At 02:37 PM 8/30/2010 +1000, Graham Dumpleton wrote: Anyway, rather than keep arguing the point and move forward, let us perhaps start now with the following definitions and new names to identify them. We can even go a bit stupid and give each its own code name so they are in part more

Re: [Web-SIG] WSGI for Python 3

2010-08-28 Thread Georg Brandl
Am 28.08.2010 13:13, schrieb Armin Ronacher: Hi, On 2010-08-28 1:04 PM, Georg Brandl wrote: Let me just throw in here that it's *NOT* too late to do something about Python 3.2. It is not even in beta state yet, and I am very willing to introduce the changes to make web programming work

Re: [Web-SIG] WSGI for Python 3

2010-08-27 Thread P.J. Eby
At 06:05 PM 8/27/2010 +0200, Christoph Zwerschke wrote: For instance, user = 'özkan'.encode('latin1') if user in request.META.get('REMOTE_USER', b'').lower(): will not work it the user has logged in as 'Özkan'. Isn't that a problem with code that does this now?

Re: [Web-SIG] WSGI for Python 3

2010-08-27 Thread Robert Brewer
Paul Davis wrote: Since the major stumbling block, irrespective of other changes, to any sort of agreement is still bytes vs unicode I ran into this while I was attempting to put together enough code to play with a wsgiref2 that ran on both 2.x and 3.x. As Graham has deftly pointed out,

Re: [Web-SIG] WSGI for Python 3

2010-08-27 Thread Paul Davis
On Fri, Aug 27, 2010 at 4:04 PM, Robert Brewer fuman...@aminus.org wrote: Paul Davis wrote: Since the major stumbling block, irrespective of other changes, to any sort of agreement is still bytes vs unicode I ran into this while I was attempting to put together enough code to play with a

Re: [Web-SIG] WSGI for Python 3

2010-08-27 Thread Armin Ronacher
Hi, On 2010-08-27 6:05 PM, Christoph Zwerschke wrote: Btw, another problem with this is that the lower() method does not know that it has to use latin1 when lowercasing. That is not a problem insofar that case insensitive HTTP tokens are limited to ASCII only. Regards, Armin

Re: [Web-SIG] WSGI for Python 3

2010-07-20 Thread Graham Dumpleton
On Tuesday, July 20, 2010, Etienne Robillard e...@gthcfoundation.org wrote: AFAICT, the main difference is that under a bytes-only regime, the changes should be more consistent/mechanical, i.e., able to be performed by relatively superficial code inspection. The problem in all

Re: [Web-SIG] WSGI for Python 3

2010-07-19 Thread Aaron Watters
I'm still in denial regarding Python 3 generally speaking, but it looks like something important is going on here.  Could someone summarize the main points (intelligible to a Python 2 troglodyte)? thanks in advance,  -- Aaron Watters === % man less less is more.

Re: [Web-SIG] WSGI for Python 3

2010-07-19 Thread Graham Dumpleton
Go back through my blog and read some of the posts there so you have some of the history. Recent discussions build on some of the stuff there and I don't think anyone has the time to keep explaining all this to every new person who comes along. Graham On Monday, July 19, 2010, Aaron Watters

Re: [Web-SIG] WSGI for Python 3

2010-07-19 Thread Paul Davis
On Tue, Jul 20, 2010 at 12:37 AM, Graham Dumpleton graham.dumple...@gmail.com wrote: On 19 July 2010 03:19, P.J. Eby p...@telecommunity.com wrote: At 01:01 PM 7/18/2010 +1000, Graham Dumpleton wrote: This is on the basis that if people are going to have to rewrite their code a fair bit to

Re: [Web-SIG] WSGI for Python 3

2010-07-18 Thread P.J. Eby
At 01:01 PM 7/18/2010 +1000, Graham Dumpleton wrote: This is on the basis that if people are going to have to rewrite their code a fair bit to handle bytes everywhere, What you mean by rewrite their code a fair bit, and who is it that you think will have to do this? Or, more precisely, how

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Graham Dumpleton
On Saturday, July 17, 2010, Gustavo Narea m...@gustavonarea.net 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

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Ian Bicking
On Sat, Jul 17, 2010 at 12:38 AM, Graham Dumpleton graham.dumple...@gmail.com wrote: On Friday, July 16, 2010, And Clover and...@doxdesk.com 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

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Armin Ronacher
Hi, On 7/17/10 9:15 AM, Ian Bicking wrote: This is an Apache-specific issue. It definitely doesn't apply to paste.httpserver, I doubt CherryPy or wsgiref. I don't really know how Nginx or other servers work. This will be an issue for every server that... * supports unicode filesystems *

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Armin Ronacher
Hi, On 7/17/10 12:57 PM, Armin Ronacher wrote: In fact, this will be an issue for things like middlewares that want to map applications to paths. In fact, this already is an issue on Python 2 already, just that nobody cares. s/applications/serving static files from folders/ Regards, Armin

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread chris . dent
On Fri, 16 Jul 2010, P.J. Eby wrote: At 02:28 PM 7/16/2010 -0500, Ian Bicking wrote: There should be one, and preferably *only* one, obvious way to do it. And given that HTTP is inherently a bunch of bytes, bytes is the one obvious way. I think this makes sense. The thing which is

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Alan Kennedy
[PJ Eby] 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 using str on Python 3000 to say we go with bytes on Python 3+ for

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread William Dode
On 17-07-2010, chris.d...@gmail.com wrote: On Fri, 16 Jul 2010, P.J. Eby wrote: At 02:28 PM 7/16/2010 -0500, Ian Bicking wrote: There should be one, and preferably *only* one, obvious way to do it. And given that HTTP is inherently a bunch of bytes, bytes is the one obvious way. I think

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Bill Janssen
Chris McDonough chr...@plope.com wrote: 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

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Graham Dumpleton
On 17 July 2010 22:30, chris.d...@gmail.com wrote: On Fri, 16 Jul 2010, P.J. Eby wrote: At 02:28 PM 7/16/2010 -0500, Ian Bicking wrote: There should be one, and preferably *only* one, obvious way to do it. And given that HTTP is inherently a bunch of bytes, bytes is the one obvious way.

Re: [Web-SIG] WSGI for Python 3

2010-07-17 Thread Chris McDonough
On Fri, 2010-07-16 at 23:38 -0500, Ian Bicking wrote: On Fri, Jul 16, 2010 at 9:43 PM, Chris McDonough chr...@plope.com wrote: Nah, not nearly that hard: path_info =

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 and...@doxdesk.com 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

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 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

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 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 in Python 3, or we have text values. I think bytes will be more awkward to

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 5:08 PM, Chris McDonough chr...@plope.com 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

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 5:06 PM, Ian Bicking i...@colorstudy.com wrote: On Fri, Jul 16, 2010 at 4:47 PM, Tres Seaver tsea...@palladion.comwrote: 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

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 chr...@plope.com 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 mailto:p...@telecommunity.comp...@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 in

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 framework /

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

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:: segments =

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 our

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Ian Bicking
On Fri, Jul 16, 2010 at 8:46 PM, Ian Bicking i...@colorstudy.com 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

Re: [Web-SIG] WSGI for Python 3

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

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 you'll do it

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Ian Bicking i...@colorstudy.com wrote: On Fri, Jul 16, 2010 at 4:33 AM, And Clover and...@doxdesk.com 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

Re: [Web-SIG] WSGI for Python 3

2010-07-16 Thread Graham Dumpleton
On Saturday, July 17, 2010, Ian Bicking i...@colorstudy.com wrote: On Fri, Jul 16, 2010 at 12:28 PM, Chris McDonough chr...@plope.com 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

Re: [Web-SIG] WSGI for Python 3

2010-07-14 Thread Ian Bicking
On Wed, Jul 14, 2010 at 12:19 AM, Graham Dumpleton graham.dumple...@gmail.com wrote: * I (re)propose we eliminate SCRIPT_NAME and PATH_INFO and replace them exclusively with encoded versions (that represent the original request URI). We use Latin1 encoding, but it should be ASCII anyway,

Re: [Web-SIG] WSGI for Python 3

2010-07-13 Thread Graham Dumpleton
On 14 July 2010 14:43, Ian Bicking i...@colorstudy.com wrote: So... there's been some discussion of WSGI on Python 3 lately.  I'm not feeling as pessimistic as some people, I feel like we were close but just didn't *quite* get there. What I took from the discussion wasn't that one couldn't

Re: [Web-SIG] WSGI for Python 3

2010-07-13 Thread Ian Bicking
On Wed, Jul 14, 2010 at 12:04 AM, Graham Dumpleton graham.dumple...@gmail.com wrote: On 14 July 2010 14:43, Ian Bicking i...@colorstudy.com wrote: So... there's been some discussion of WSGI on Python 3 lately. I'm not feeling as pessimistic as some people, I feel like we were close but

Re: [Web-SIG] WSGI for Python 3

2010-07-13 Thread Graham Dumpleton
On 14 July 2010 15:04, Graham Dumpleton graham.dumple...@gmail.com wrote: On 14 July 2010 14:43, Ian Bicking i...@colorstudy.com wrote: So... there's been some discussion of WSGI on Python 3 lately.  I'm not feeling as pessimistic as some people, I feel like we were close but just didn't

Re: [Web-SIG] WSGI for Python 3

2010-07-13 Thread Graham Dumpleton
On 14 July 2010 15:18, Ian Bicking i...@colorstudy.com wrote: On Wed, Jul 14, 2010 at 12:04 AM, Graham Dumpleton graham.dumple...@gmail.com wrote: On 14 July 2010 14:43, Ian Bicking i...@colorstudy.com wrote: So... there's been some discussion of WSGI on Python 3 lately.  I'm not feeling