CIDR represenation if IPAddr object is a network prefix

pull/1414/head
Alexander Koeppe 9 years ago committed by sebres
parent 941a2b6c82
commit 1b21f21c22

@ -203,10 +203,15 @@ class IPAddr(object):
self._raw = ipstring
def __repr__(self):
return self.ntoa
if self.isIPv4 and self.plen < 32:
return "%s/%d" % (self.ntoa, self.plen)
elif self.isIPv6 and self.plen < 128:
return "%s/%d" % (self.ntoa, self.plen)
else:
return self.ntoa
def __str__(self):
return self.ntoa
return self.__repr__()
@property
def addr(self):

Loading…
Cancel
Save