better utils.py, thanks Niphlod

This commit is contained in:
mdipierro
2012-10-27 14:37:40 -05:00
parent 5a478302f4
commit 5953377060
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-10-26 15:51:12) stable
Version 2.2.1 (2012-10-27 14:37:32) stable
+3 -4
View File
@@ -9,7 +9,6 @@ License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This file specifically includes utilities for security.
"""
import string
import threading
import struct
import hashlib
@@ -38,7 +37,7 @@ try:
except ImportError:
try:
from .aes import AES
except (ImportError, ValueError):
except ImportError:
from contrib.aes import AES
try:
@@ -271,7 +270,7 @@ def is_valid_ip_address(address):
address = address[7:]
if hasattr(socket, 'inet_aton'): # try validate using the OS
try:
addr = socket.inet_aton(address)
socket.inet_aton(address)
return True
except socket.error: # invalid address
return False
@@ -282,7 +281,7 @@ def is_valid_ip_address(address):
return False
elif hasattr(socket, 'inet_pton'): # assume IPv6, try using the OS
try:
addr = socket.inet_pton(socket.AF_INET6, address)
socket.inet_pton(socket.AF_INET6, address)
return True
except socket.error: # invalid address
return False