Fix semantic breakage for Python 2.1 (yes, WSGI supports Python 2.1,

which doesn't have an 'object' type), and the description using
iter(filelike.read, '') was intentional; changing it broke the
spec.  (I.e., running that portion of the spec would raise TypeError)
This commit is contained in:
Phillip J. Eby 2010-09-16 20:00:17 +00:00
parent 3f67de0a88
commit 86b7e8aba9
1 changed files with 5 additions and 5 deletions

View File

@ -172,7 +172,7 @@ other is a class::
return ['Hello world!\n'] return ['Hello world!\n']
class AppClass(object): class AppClass:
"""Produce the same output, but using a class """Produce the same output, but using a class
(Note: 'AppClass' is the "application" here, so calling it (Note: 'AppClass' is the "application" here, so calling it
@ -321,7 +321,7 @@ a block boundary.)
from piglatin import piglatin from piglatin import piglatin
class LatinIter(object): class LatinIter:
"""Transform iterated output to piglatin, if it's okay to do so """Transform iterated output to piglatin, if it's okay to do so
@ -345,7 +345,7 @@ a block boundary.)
else: else:
return self._next() return self._next()
class Latinator(object): class Latinator:
# by default, don't transform output # by default, don't transform output
transform = False transform = False
@ -1371,7 +1371,7 @@ it is not guaranteed that any wrapper created will actually be used.)
Apart from the handling of ``close()``, the semantics of returning a Apart from the handling of ``close()``, the semantics of returning a
file wrapper from the application should be the same as if the file wrapper from the application should be the same as if the
application had returned ``iter(filelike, '')``. In other words, application had returned ``iter(filelike.read, '')``. In other words,
transmission should begin at the current position within the "file" transmission should begin at the current position within the "file"
at the time that transmission begins, and continue until the end is at the time that transmission begins, and continue until the end is
reached. reached.
@ -1390,7 +1390,7 @@ the ``wsgi.file_wrapper`` **must** still return an iterable that wraps
are portable across platforms. Here's a simple platform-agnostic are portable across platforms. Here's a simple platform-agnostic
file wrapper class, suitable for old (pre 2.2) and new Pythons alike:: file wrapper class, suitable for old (pre 2.2) and new Pythons alike::
class FileWrapper(object): class FileWrapper:
def __init__(self, filelike, blksize=8192): def __init__(self, filelike, blksize=8192):
self.filelike = filelike self.filelike = filelike