[Web-SIG] Python 3.0 and WSGI 1.0.

Robert Brewer fumanchu at aminus.org
Tue May 5 16:55:51 CEST 2009


Graham Dumpleton wrote:
> 2009/5/5 Armin Ronacher <armin.ronacher at active-4.com>:
>> Graham Dumpleton wrote:
>>> I can't see but have choice but to pass such settings through as
>>> strings, else more than likely would cause problems for applications.
>>> Problem is it isn't clear what encoding stuff can be in Apache
>>> configuration. At the moment latin-1 is assumed.
>> Because those information does not have a specified encoding I can see
>> nothing wrong with it passing that information as bytestrings.  I would
>> have no problem passing *all* values as bytestrings.
> 
> At what point does that become an inconvenience though? I guess that
> is my concern, because if one has to do too many manual conversions in
> an application, people will start to complain it becomes unwieldy to
> use. In other words, you make it easier or more logical for
> frameworks, but do you end up putting more burden on applications for
> stuff outside those core values.
> 
> So, for those core CGI values which the framework is going to modify
> even before an application sees them, then fine. Is the framework also
> going to set the rules as to what encoding is used for other values in
> the WSGI environment and convert them per that encoding when an
> application requests them, or is the application always going to have
> to deal with them as bytes?
> 
> As I keep saying, you guys who write the frameworks and applications
> are going to know better than I, I am just challenging the notions as
> a way of making people think about it so the end result is what is the
> most logical thing to do. ;-)

In short: it's pretty easy for a framework to default to utf-8 for 
everything, yet give application developers ways to override that. See, 
for example, the cherrypy.tools.encoding Tool in our python3 
branch--it's moved from running "sometime" after the page handler, to 
wrapping the page handler so all page handlers emit bytes. That makes it 
possible for everyone to use unicode strings everywhere, yet still allow 
some to specify exact bytes as necessary. In shorter: don't worry about 
that part, we've got it covered. ;)


Robert Brewer
fumanchu at aminus.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/web-sig/attachments/20090505/27c3a7f5/attachment.htm>


More information about the Web-SIG mailing list