better info to debug issue 921

This commit is contained in:
mdipierro
2012-08-08 09:35:01 -05:00
parent fdc895a1db
commit d7c00f2240
3 changed files with 7 additions and 6 deletions
+4 -4
View File
@@ -157,14 +157,14 @@ def is_valid_ip_address(address):
True
"""
try:
if address.count('.')==3:
if address.count('.')==3: # guess IPv4
addr = socket.inet_aton(address)
else:
else: # guess IPv6
addr = socket.inet_pton(socket.AF_INET6, address)
except socket.error: # invalid address
return False
except AttributeError: # no socket.inet_pton
return False
except socket.error:
return False
return True