From e1c6e4a7c811c91d6f6806a179ebe8cb40dbbd33 Mon Sep 17 00:00:00 2001 From: "pmoody@google.com" Date: Fri, 21 Jan 2011 00:10:13 +0000 Subject: + 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 --- trunk/ipaddr.py | 28 ++++++++++++++-------------- 1 file 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 -- cgit v1.2.1