[Web-SIG] WSGI for Python 3

Tres Seaver tseaver at palladion.com
Sat Jul 17 03:11:47 CEST 2010


-----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 = PATH_INFO.split('/')
>>
>> - Then, de-encode each segment's urlencoded portions:
>>
>>     urldecoded_segments = [ urllib.unquote(x) for x in segments ]
>>
>> - Then re-encode each urldecoded segment into the encoding expected
>>   by your application
>>
>>     app_segments = [ str(x, encoding='utf-8') for x in
>>                      urldecoded_segments ]
>> """
> 
> +1.  I do wish we actually *had* a bytes-with-benefits type (as I 
> proposed on Python-Dev), but I don't think we can really get one 
> until the language moratorium is over.  Plain old bytes are the next 
> best thing. 

We might be able to write one which would work in reduce-instruction-set
mode, and have the server wrap the environ valuee in it.  Some
operations might not be "natural", and we might have to implement some
wrappers around stdlib stuff, but maybe it would be worthwhile to try a
spike on it.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkxBA00ACgkQ+gerLs4ltQ4xlQCghykpuIBK97nwJczkZpddlrCf
rZQAoI6xRwsIo5jQiD781o8Q5Y5wxoSx
=4WBq
-----END PGP SIGNATURE-----



More information about the Web-SIG mailing list