[Python-checkins] r86129 - in python/branches/py3k: Lib/nntplib.py Lib/test/test_nntplib.py Misc/NEWS

antoine.pitrou python-checkins at python.org
Tue Nov 2 23:31:52 CET 2010


Author: antoine.pitrou
Date: Tue Nov  2 23:31:52 2010
New Revision: 86129

Log:
Issue #10280: NNTP.nntp_version should reflect the highest version
advertised by the server.



Modified:
   python/branches/py3k/Lib/nntplib.py
   python/branches/py3k/Lib/test/test_nntplib.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/nntplib.py
==============================================================================
--- python/branches/py3k/Lib/nntplib.py	(original)
+++ python/branches/py3k/Lib/nntplib.py	Tue Nov  2 23:31:52 2010
@@ -361,7 +361,9 @@
         else:
             self._caps = caps
             if 'VERSION' in caps:
-                self.nntp_version = int(caps['VERSION'][0])
+                # The server can advertise several supported versions,
+                # choose the highest.
+                self.nntp_version = max(map(int, caps['VERSION']))
 
     def getwelcome(self):
         """Get the welcome message from the server

Modified: python/branches/py3k/Lib/test/test_nntplib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_nntplib.py	(original)
+++ python/branches/py3k/Lib/test/test_nntplib.py	Tue Nov  2 23:31:52 2010
@@ -558,7 +558,7 @@
     def handle_CAPABILITIES(self):
         self.push_lit("""\
             101 Capability list:
-            VERSION 2
+            VERSION 2 3
             IMPLEMENTATION INN 2.5.1
             AUTHINFO USER
             HDR
@@ -935,7 +935,7 @@
     def test_caps(self):
         caps = self.server.getcapabilities()
         self.assertEqual(caps, {
-            'VERSION': ['2'],
+            'VERSION': ['2', '3'],
             'IMPLEMENTATION': ['INN', '2.5.1'],
             'AUTHINFO': ['USER'],
             'HDR': [],
@@ -945,7 +945,7 @@
             'POST': [],
             'READER': [],
             })
-        self.assertEqual(self.server.nntp_version, 2)
+        self.assertEqual(self.server.nntp_version, 3)
 
 
 class MiscTests(unittest.TestCase):

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Tue Nov  2 23:31:52 2010
@@ -59,6 +59,9 @@
 Library
 -------
 
+- Issue #10280: NNTP.nntp_version should reflect the highest version
+  advertised by the server.
+
 - Issue #10184: Touch directories only once when extracting a tarfile.
 
 - Issue #10199: New package, ``turtledemo`` now contains selected demo


More information about the Python-checkins mailing list