[svn] commit: r3070 - /branches/trac353/src/lib/python/isc/net/check.py

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Sep 29 14:29:15 UTC 2010


Author: vorner
Date: Wed Sep 29 14:29:14 2010
New Revision: 3070

Log:
Implement the port_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 14:29:14 2010
@@ -23,7 +23,14 @@
     the port as int. If it is not a valid port (the string doesn't contain
     number or it is not in the valid range), it raises ValueError.
     """
-    pass
+    inted = int(port)
+    if inted < 0:
+        raise ValueError("Port value " + str(inted) +
+            " too small, allower range is 0-65535")
+    if inted > 65535:
+        raise ValueError("Port value " + str(inted) +
+            " too large, allowed range is 0-65535")
+    return inted
 
 def addr_check(addr):
     """




More information about the bind10-changes mailing list