Commit c7485064 authored by Georg Brandl's avatar Georg Brandl

#5636: fix next -> __next__ in csv reader docs.

parent 9ae3640b
...@@ -351,14 +351,13 @@ Reader Objects ...@@ -351,14 +351,13 @@ Reader Objects
Reader objects (:class:`DictReader` instances and objects returned by the Reader objects (:class:`DictReader` instances and objects returned by the
:func:`reader` function) have the following public methods: :func:`reader` function) have the following public methods:
.. method:: csvreader.__next__()
.. method:: csvreader.next()
Return the next row of the reader's iterable object as a list, parsed according Return the next row of the reader's iterable object as a list, parsed according
to the current dialect. to the current dialect. Usually you should call this as ``next(reader)``.
Reader objects have the following public attributes:
Reader objects have the following public attributes:
.. attribute:: csvreader.dialect .. attribute:: csvreader.dialect
...@@ -371,10 +370,8 @@ Reader objects have the following public attributes: ...@@ -371,10 +370,8 @@ Reader objects have the following public attributes:
number of records returned, as records can span multiple lines. number of records returned, as records can span multiple lines.
DictReader objects have the following public attribute: DictReader objects have the following public attribute:
.. attribute:: csvreader.fieldnames .. attribute:: csvreader.fieldnames
If not passed as a parameter when creating the object, this attribute is If not passed as a parameter when creating the object, this attribute is
......
...@@ -598,7 +598,11 @@ class CGIHandlerTestCase(unittest.TestCase): ...@@ -598,7 +598,11 @@ class CGIHandlerTestCase(unittest.TestCase):
sys.stdin = open("xmldata.txt", "r") sys.stdin = open("xmldata.txt", "r")
sys.stdout = open(support.TESTFN, "w") sys.stdout = open(support.TESTFN, "w")
self.cgi.handle_request() os.environ['CONTENT_LENGTH'] = str(len(data))
try:
self.cgi.handle_request()
finally:
del os.environ['CONTENT_LENGTH']
sys.stdin.close() sys.stdin.close()
sys.stdout.close() sys.stdout.close()
......
...@@ -590,7 +590,7 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): ...@@ -590,7 +590,7 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
# POST data is normally available through stdin # POST data is normally available through stdin
try: try:
length = int(os.environ.get('CONTENT_LENGTH', None)) length = int(os.environ.get('CONTENT_LENGTH', None))
except ValueError: except (ValueError, TypeError):
length = -1 length = -1
if request_text is None: if request_text is None:
request_text = sys.stdin.read(length) request_text = sys.stdin.read(length)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment