This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author grahamd
Recipients grahamd, hdima, pitrou, pje
Date 2009-01-01.23:20:35
SpamBayes Score 2.0556463e-06
Marked as misclassified No
Message-id <1230852036.91.0.153383854132.issue4718@psf.upfronthosting.co.za>
In-reply-to
Content
One interesting thing of note that has occurred to me looking at the patch 
is that although with Python <3.0 you technically could return a str as 
iterable from application, ie., because iteration over str returns str for 
each character, the same doesn't really apply to bytes in Python 3.0. This 
is because iterating over bytes yields an int fdor each item.

Thus have odd situation where with Python 3.0, one could technically return 
str as iterable, with rule that would apply would be that each str returned 
would then be converted to bytes by way of latin-1 conversion, but for 
bytes returned as iterable, should fail.

Not sure how this plays out in wsgiref server yet as haven't looked. 
Anyway, make the validator code:

@@ -426,6 +436,6 @@
     # Technically a string is legal, which is why it's a really bad
     # idea, because it may cause the response to be returned
     # character-by-character
-    assert_(not isinstance(iterator, str),
+    assert_(not isinstance(iterator, (str, bytes)),
         "You should not return a string as your application iterator, "
         "instead return a single-item list containing that string.")

quite a good thing to have.
History
Date User Action Args
2009-01-01 23:20:37grahamdsetrecipients: + grahamd, pje, hdima, pitrou
2009-01-01 23:20:36grahamdsetmessageid: <1230852036.91.0.153383854132.issue4718@psf.upfronthosting.co.za>
2009-01-01 23:20:36grahamdlinkissue4718 messages
2009-01-01 23:20:35grahamdcreate