try:
c = new(address)
return c
- except (ValueError, socket.error):
+ except socket.error:
return False
return
if not self.is_valid_cidr(address):
- raise ValueError, \
+ raise socket.error, \
repr(address) + " is not a valid CIDR representation"
if netlen < 0:
address is numerically less or if the block is larger. That
is, supernets will sort before subnets. This ordering allows
for an efficient search for subnets of a given network."""
-
+ if not isinstance(other, Cidr): return -1
res = self._base_mask(self.numaddr) - other._base_mask(other.numaddr)
if res == 0: res = self.netlen - other.netlen
if res < 0: return -1
self._convert_ipstr(address)
return True
except socket.error, e:
- print "Failed to convert address string '%s': " + str(e) % (address)
return False
def _base_mask(self, numaddr):