Emulate numeric objects through network aggregation
(self, other)
| 885 | return ("IP('%s')" % (self.strCompressed(1))) |
| 886 | |
| 887 | def __add__(self, other): |
| 888 | """Emulate numeric objects through network aggregation""" |
| 889 | if self.prefixlen() != other.prefixlen(): |
| 890 | raise ValueError, "Only networks with the same prefixlen can be added." |
| 891 | if self.prefixlen < 1: |
| 892 | raise ValueError, "Networks with a prefixlen longer than /1 can't be added." |
| 893 | if self.version() != other.version(): |
| 894 | raise ValueError, "Only networks with the same IP version can be added." |
| 895 | if self > other: |
| 896 | # fixed by Skinny Puppy <skin_pup-IPy@happypoo.com> |
| 897 | return other.__add__(self) |
| 898 | else: |
| 899 | ret = IP(self.int()) |
| 900 | ret._prefixlen = self.prefixlen() - 1 |
| 901 | return ret |
| 902 | |
| 903 | |
| 904 | def _parseAddressIPv6(ipstr): |