[Zconfig] SVN: ZConfig/trunk/ revert revision 33264:
Fred L. Drake, Jr.
fdrake at gmail.com
Tue Aug 2 18:36:14 EDT 2005
Log message for revision 37670:
revert revision 33264:
- no use case for this presented on the zconfig list
- no documentation
Changed:
U ZConfig/trunk/datatypes.py
U ZConfig/trunk/tests/test_datatypes.py
-=-
Modified: ZConfig/trunk/datatypes.py
===================================================================
--- ZConfig/trunk/datatypes.py 2005-08-02 22:18:06 UTC (rev 37669)
+++ ZConfig/trunk/datatypes.py 2005-08-02 22:36:14 UTC (rev 37670)
@@ -164,24 +164,7 @@
return s.split()
-def port_number(portliteral,protocol='tcp'):
- "replacement for simple rangecheck to allow etc/services entries as ports"
- import socket
- try:
- p=integer(portliteral)
- except ValueError:
- try:
- p=socket.getservbyname(portliteral,protocol)
- except socket.error:
- raise ValueError("%r is not in etc/services" % portliteral)
- return p
- if p < 1:
- raise ValueError("%s is below lower bound (%s)"
- % (`p`, 1))
- if p > 0xffff:
- raise ValueError("%s is above upper bound (%s)"
- % (`p`, 0xffff))
- return p
+port_number = RangeCheckedConversion(integer, min=1, max=0xffff).__call__
class InetAddress:
Modified: ZConfig/trunk/tests/test_datatypes.py
===================================================================
--- ZConfig/trunk/tests/test_datatypes.py 2005-08-02 22:18:06 UTC (rev 37669)
+++ ZConfig/trunk/tests/test_datatypes.py 2005-08-02 22:36:14 UTC (rev 37670)
@@ -186,8 +186,6 @@
eq(convert(":80"), (defhost, 80))
eq(convert("80"), (defhost, 80))
eq(convert("host.EXAMPLE.com"), ("host.example.com", None))
- # test getservbyname - breaks if services file is bad
- eq(convert(":chargen"), (defhost,19))
self.assertRaises(ValueError, convert, "40 # foo")
def test_datatype_inet_binding_address(self):
@@ -198,8 +196,6 @@
eq(convert(":80"), (defhost, 80))
eq(convert("80"), (defhost, 80))
eq(convert("host.EXAMPLE.com"), ("host.example.com", None))
- # test getservbyname - breaks if services file is bad
- eq(convert(":chargen"), (defhost,19))
self.assertRaises(ValueError, convert, "40 # foo")
def test_datatype_inet_connection_address(self):
@@ -210,8 +206,6 @@
eq(convert(":80"), (defhost, 80))
eq(convert("80"), (defhost, 80))
eq(convert("host.EXAMPLE.com"), ("host.example.com", None))
- # test getservbyname - breaks if services file is bad
- eq(convert(":chargen"), (defhost,19))
self.assertRaises(ValueError, convert, "40 # foo")
def test_datatype_integer(self):
More information about the ZConfig
mailing list