Glenn Linderman <v+pyt...@g.nevcal.com> added the comment:

Victor, thanks for your comments, and interest in this bug.  Other than the 
existence of the charset parameter, and whether or not to include IOMix, I 
think all of the others could be fixed later, and do not hurt at present.  So I 
will just comment on those two comments.

I would prefer to see FieldStorage not have the charset attribute also, but I 
don't have the practice to produce an alternate patch, and I can see that it 
would be a convenience for some CGI scripts to specify that parameter, and have 
one API call do all the work necessary to adjust the IO streams, and read all 
the parameters, and then the rest of the logic of the web app can follow.  
Personally, I adjust the stdout/stderr streams earlier in my scripts, and only 
optionally call FieldStorage, if I determine the request needs such.

I've been using IOMix for some months (I have a version for both Python 2 and 
3), and it solves a real problem in generating web page data streams... the 
data stream should be bytes, but a lot of the data is manipulated using str, 
which would then need to be decoded.  The default encoding of stdout is usually 
wrong, so must somehow be changed.  And when you have chunks of bytes (in my 
experience usually from a database or file) to copy to the output stream, if 
your prior write was str, and then you write bytes to sys.stdout.binary, you 
have to also remember to flush the TextIOBuffer first.  IOMix provides a 
convenient solution to all these problems, doing the flushing for you 
automatically, and just taking what comes and doing the right thing.  If I 
hadn't already invented IOMix to help write web pages, I would want to :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4953>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to