summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035>2011-01-21 00:10:13 +0000
committerpmoody@google.com <pmoody@google.com@09200d28-7f98-11dd-ad27-0f66e57d2035>2011-01-21 00:10:13 +0000
commite1c6e4a7c811c91d6f6806a179ebe8cb40dbbd33 (patch)
treec7068ec687837e99861f705e51082f75ce285401
parentb8ebb477ad171007b29887305562c87d75d98239 (diff)
downloadipaddr-py-e1c6e4a7c811c91d6f6806a179ebe8cb40dbbd33.tar.gz
+ fix for i74, python3x and byte addresses.
+ docstring fix to remove references to long-deceased IP() function git-svn-id: https://ipaddr-py.googlecode.com/svn@205 09200d28-7f98-11dd-ad27-0f66e57d2035
-rw-r--r--trunk/ipaddr.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/trunk/ipaddr.py b/trunk/ipaddr.py
index d1d98a2..84db9c1 100644
--- a/trunk/ipaddr.py
+++ b/trunk/ipaddr.py
@@ -436,7 +436,7 @@ class _BaseIP(_IPAddrBase):
"""
def __init__(self, address):
- if '/' in str(address):
+ if not isinstance(address, bytes) and '/' in str(address):
raise AddressValueError(address)
def __eq__(self, other):
@@ -696,28 +696,28 @@ class _BaseNet(_IPAddrBase):
For example:
- addr1 = IP('10.1.1.0/24')
- addr2 = IP('10.1.1.0/26')
+ addr1 = IPNetwork('10.1.1.0/24')
+ addr2 = IPNetwork('10.1.1.0/26')
addr1.address_exclude(addr2) =
- [IP('10.1.1.64/26'), IP('10.1.1.128/25')]
+ [IPNetwork('10.1.1.64/26'), IPNetwork('10.1.1.128/25')]
or IPv6:
- addr1 = IP('::1/32')
- addr2 = IP('::1/128')
- addr1.address_exclude(addr2) = [IP('::0/128'),
- IP('::2/127'),
- IP('::4/126'),
- IP('::8/125'),
+ addr1 = IPNetwork('::1/32')
+ addr2 = IPNetwork('::1/128')
+ addr1.address_exclude(addr2) = [IPNetwork('::0/128'),
+ IPNetwork('::2/127'),
+ IPNetwork('::4/126'),
+ IPNetwork('::8/125'),
...
- IP('0:0:8000::/33')]
+ IPNetwork('0:0:8000::/33')]
Args:
- other: An IP object of the same type.
+ other: An IPvXNetwork object of the same type.
Returns:
- A sorted list of IP objects addresses which is self minus
- other.
+ A sorted list of IPvXNetwork objects addresses which is self
+ minus other.
Raises:
TypeError: If self and other are of difffering address