[svn] commit: r3073 - /branches/trac353/src/lib/python/isc/net/check.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Sep 29 20:32:32 UTC 2010
Author: vorner
Date: Wed Sep 29 20:32:32 2010
New Revision: 3073
Log:
Implement the addr_check function
Modified:
branches/trac353/src/lib/python/isc/net/check.py
Modified: branches/trac353/src/lib/python/isc/net/check.py
==============================================================================
--- branches/trac353/src/lib/python/isc/net/check.py (original)
+++ branches/trac353/src/lib/python/isc/net/check.py Wed Sep 29 20:32:32 2010
@@ -16,6 +16,9 @@
"""
Checking and parsing of ports and IP addresses.
"""
+
+from isc.net.addr import IPAddr
+import socket
def port_check(port):
"""
@@ -38,4 +41,8 @@
the IPAddr object. It raises ValueError if the passed string is not
valid IP address.
"""
- pass
+ try:
+ return IPAddr(addr)
+ except socket.error:
+ raise ValueError('Value ' + addr +
+ ' is not valid IPv4 or IPv6 address')
More information about the bind10-changes
mailing list