]> granicus.if.org Git - python/commitdiff
#5636: fix next -> __next__ in csv reader docs.
authorGeorg Brandl <georg@python.org>
Wed, 1 Apr 2009 15:53:15 +0000 (15:53 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 1 Apr 2009 15:53:15 +0000 (15:53 +0000)
Doc/library/csv.rst
Lib/test/test_xmlrpc.py
Lib/xmlrpc/server.py

index 80ddaad947f6385f7f4ace5a8b4664e1e778b411..46ef246b39075c4b4c8f70aa6a29e9f22c59fd77 100644 (file)
@@ -351,14 +351,13 @@ Reader Objects
 Reader objects (:class:`DictReader` instances and objects returned by the
 :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
-   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
 
@@ -371,10 +370,8 @@ Reader objects have the following public attributes:
    number of records returned, as records can span multiple lines.
 
 
-
 DictReader objects have the following public attribute:
 
-
 .. attribute:: csvreader.fieldnames
 
    If not passed as a parameter when creating the object, this attribute is
index d1ed40fa29e83312428d142006cc6567a539da08..1f5f5aa4f3cfe011b7f5dd462ddb8f56f4df12f8 100644 (file)
@@ -598,7 +598,11 @@ class CGIHandlerTestCase(unittest.TestCase):
         sys.stdin = open("xmldata.txt", "r")
         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.stdout.close()
index eb807c484b7c64a2264048739eb96aef4f45d6f7..ea828a52e98a9982b4dac61d2232477402093e81 100644 (file)
@@ -590,7 +590,7 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
             # POST data is normally available through stdin
             try:
                 length = int(os.environ.get('CONTENT_LENGTH', None))
-            except ValueError:
+            except (ValueError, TypeError):
                 length = -1
             if request_text is None:
                 request_text = sys.stdin.read(length)