[Python-checkins] r70955 - in python/branches/py3k: Doc/library/csv.rst Lib/test/test_xmlrpc.py Lib/xmlrpc/server.py

georg.brandl python-checkins at python.org
Wed Apr 1 17:53:15 CEST 2009


Author: georg.brandl
Date: Wed Apr  1 17:53:15 2009
New Revision: 70955

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

Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Doc/library/csv.rst
   python/branches/py3k/Lib/test/test_xmlrpc.py
   python/branches/py3k/Lib/xmlrpc/server.py

Modified: python/branches/py3k/Doc/library/csv.rst
==============================================================================
--- python/branches/py3k/Doc/library/csv.rst	(original)
+++ python/branches/py3k/Doc/library/csv.rst	Wed Apr  1 17:53:15 2009
@@ -351,14 +351,13 @@
 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 @@
    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

Modified: python/branches/py3k/Lib/test/test_xmlrpc.py
==============================================================================
--- python/branches/py3k/Lib/test/test_xmlrpc.py	(original)
+++ python/branches/py3k/Lib/test/test_xmlrpc.py	Wed Apr  1 17:53:15 2009
@@ -598,7 +598,11 @@
         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()

Modified: python/branches/py3k/Lib/xmlrpc/server.py
==============================================================================
--- python/branches/py3k/Lib/xmlrpc/server.py	(original)
+++ python/branches/py3k/Lib/xmlrpc/server.py	Wed Apr  1 17:53:15 2009
@@ -590,7 +590,7 @@
             # 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)


More information about the Python-checkins mailing list