diff options
author | Peter Moody <pmoody@google.com> | 2010-04-29 17:15:43 +0000 |
---|---|---|
committer | Peter Moody <pmoody@google.com> | 2010-04-29 17:15:43 +0000 |
commit | 60eb261c7f67c6a91dc213bd680dd01d0b075510 (patch) | |
tree | 6194886f4e98a4f2ea778eb542c1913e4db24182 /ipaddr.py | |
parent | a8992e0b0c9793e227c9955437cf3ed09be01424 (diff) | |
download | ipaddr-py-60eb261c7f67c6a91dc213bd680dd01d0b075510.tar.gz |
+ one more address_exclude cleanup, to make sure network/address exclusions
fail as expected.
git-svn-id: https://ipaddr-py.googlecode.com/svn/trunk@163 09200d28-7f98-11dd-ad27-0f66e57d2035
Diffstat (limited to 'ipaddr.py')
-rw-r--r-- | ipaddr.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -198,7 +198,7 @@ def summarize_address_range(first, last): raise TypeError('first and last must be IP addresses, not networks') if first.version != last.version: raise TypeError("%s and %s are not of the same version" % ( - str(self), str(other))) + str(self), str(other))) if first > last: raise ValueError('last IP address must be greater than first') @@ -356,7 +356,7 @@ def get_mixed_type_key(obj): doesn't make any sense. There are some times however, where you may wish to have ipaddr sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). - + Args: obj: either a Network or Address object. Returns: @@ -684,7 +684,7 @@ class _BaseNet(_IPAddrBase): Raises: TypeError: If self and other are of difffering address - versions. + versions, or if other is not a network object. ValueError: If other is not completely contained by self. """ @@ -692,6 +692,9 @@ class _BaseNet(_IPAddrBase): raise TypeError("%s and %s are not of the same version" % ( str(self), str(other))) + if not isinstance(other, _BaseNet): + raise TypeError("%s is not a network object" % str(other)) + if other not in self: raise ValueError('%s not contained in %s' % (str(other), str(self))) |