summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035>2011-12-04 19:28:43 +0000
committerpmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035>2011-12-04 19:28:43 +0000
commit869467f1a125e90db5d373626a3b758567ca4283 (patch)
treed0d2ef4e332ca8200cba84331f0279567712b942
parent563ec13fd9cfa5bb4058f4399b39fbe41e9a61df (diff)
downloadipaddr-py-869467f1a125e90db5d373626a3b758567ca4283.tar.gz
fix exploding network bug
git-svn-id: https://ipaddr-py.googlecode.com/svn@240 09200d28-7f98-11dd-ad27-0f66e57d2035
-rw-r--r--branches/3144/ipaddr.py9
-rwxr-xr-xbranches/3144/ipaddr_test.py3
2 files changed, 9 insertions, 3 deletions
diff --git a/branches/3144/ipaddr.py b/branches/3144/ipaddr.py
index 79345ce..5487d7a 100644
--- a/branches/3144/ipaddr.py
+++ b/branches/3144/ipaddr.py
@@ -1657,10 +1657,13 @@ class _BaseV6(object):
A string, the expanded IPv6 address.
"""
- if isinstance(self, _BaseInterface):
- ip_str = str(self.ip)
- else:
+ if isinstance(self, IPv6Network):
+ ip_str = str(self.network_address)
+ elif isinstance(self, _BaseAddress):
ip_str = str(self)
+ else:
+ # _BaseInterface
+ ip_str = str(self.ip)
ip_int = self._ip_int_from_string(ip_str)
parts = []
diff --git a/branches/3144/ipaddr_test.py b/branches/3144/ipaddr_test.py
index 259d010..0239550 100755
--- a/branches/3144/ipaddr_test.py
+++ b/branches/3144/ipaddr_test.py
@@ -972,6 +972,7 @@ class IpaddrUnitTest(unittest.TestCase):
def testExplodeShortHandIpStr(self):
addr1 = ipaddr.IPv6Interface('2001::1')
addr2 = ipaddr.IPv6Address('2001:0:5ef5:79fd:0:59d:a0e5:ba1')
+ addr3 = ipaddr.IPv6Network('2001::/96')
self.assertEqual('2001:0000:0000:0000:0000:0000:0000:0001/128',
addr1.exploded)
self.assertEqual('0000:0000:0000:0000:0000:0000:0000:0001/128',
@@ -979,6 +980,8 @@ class IpaddrUnitTest(unittest.TestCase):
# issue 77
self.assertEqual('2001:0000:5ef5:79fd:0000:059d:a0e5:0ba1',
addr2.exploded)
+ self.assertEqual('2001:0000:0000:0000:0000:0000:0000:0000/96',
+ addr3.exploded)
def testIntRepresentation(self):
self.assertEqual(16909060, int(self.ipv4))