the result of function validipaddr heavily depends on "assert"
statement which will be optimized in python -O mode. so the result
would be constantly True no matter what the address is.
here is the patch, please check this out.

--- net.py.orig 2008-01-19 15:14:17.000000000 +0800
+++ net.py      2008-06-08 04:30:19.000000000 +0800
@@ -18,9 +18,9 @@
     """returns True if `address` is a valid IPv4 address"""
     try:
         octets = address.split('.')
-        assert len(octets) == 4
+        if len(octets) != 4: return False
         for x in octets:
-            assert 0 <= int(x) <= 255
+            if not (0 <= int(x) <= 255): return False
     except (AssertionError, ValueError):
         return False
     return True
@@ -28,7 +28,7 @@
 def validipport(port):
     """returns True if `port` is a valid IPv4 port"""
     try:
-        assert 0 <= int(port) <= 65535
+        if not (0 <= int(port) <= 65535): return False
     except (AssertionError, ValueError):
         return False
     return True

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to