[Checkins] SVN: ZConfig/trunk/ Fixed: port values of 0 weren't allowed. Port 0 is used to request

jim cvs-admin at zope.org
Fri Jun 22 18:44:07 UTC 2012


Log message for revision 127039:
  Fixed: port values of 0 weren't allowed.  Port 0 is used to request
  an ephemeral port.
  

Changed:
  U   ZConfig/trunk/NEWS.txt
  U   ZConfig/trunk/ZConfig/datatypes.py
  U   ZConfig/trunk/ZConfig/tests/test_datatypes.py

-=-
Modified: ZConfig/trunk/NEWS.txt
===================================================================
--- ZConfig/trunk/NEWS.txt	2012-06-22 18:36:42 UTC (rev 127038)
+++ ZConfig/trunk/NEWS.txt	2012-06-22 18:44:03 UTC (rev 127039)
@@ -3,6 +3,12 @@
 ==========================
 
 
+ZConfig 2.9.3 (2012-06-22)
+--------------------------
+
+- Fixed: port values of 0 weren't allowed.  Port 0 is used to request
+  an ephemeral port.
+
 ZConfig 2.9.2 (2012-02-11)
 --------------------------
 

Modified: ZConfig/trunk/ZConfig/datatypes.py
===================================================================
--- ZConfig/trunk/ZConfig/datatypes.py	2012-06-22 18:36:42 UTC (rev 127038)
+++ ZConfig/trunk/ZConfig/datatypes.py	2012-06-22 18:44:03 UTC (rev 127039)
@@ -164,7 +164,7 @@
     return s.split()
 
 
-port_number = RangeCheckedConversion(integer, min=1, max=0xffff).__call__
+port_number = RangeCheckedConversion(integer, min=0, max=0xffff).__call__
 
 
 class InetAddress:

Modified: ZConfig/trunk/ZConfig/tests/test_datatypes.py
===================================================================
--- ZConfig/trunk/ZConfig/tests/test_datatypes.py	2012-06-22 18:36:42 UTC (rev 127038)
+++ ZConfig/trunk/ZConfig/tests/test_datatypes.py	2012-06-22 18:44:03 UTC (rev 127039)
@@ -183,6 +183,7 @@
         eq = self.assertEqual
         defhost = ZConfig.datatypes.DEFAULT_HOST
         eq(convert("Host.Example.Com:80"), ("host.example.com", 80))
+        eq(convert("Host.Example.Com:0"), ("host.example.com", 0))
         eq(convert(":80"),                 (defhost, 80))
         eq(convert("80"),                  (defhost, 80))
         eq(convert("[::1]:80"),            ("::1", 80))
@@ -247,7 +248,7 @@
         raises = self.assertRaises
 
         raises(ValueError, convert, '-1')
-        raises(ValueError, convert, '0')
+        eq(convert('0'), 0)
         eq(convert('1'), 1)
         eq(convert('80'), 80)
         eq(convert('1023'), 1023)



More information about the checkins mailing list