Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 559366 | Differences between
and this patch

Collapse All | Expand All

(-)a/spf.py (-5 / +10 lines)
Lines 102-111 Link Here
102
    # Python standard libarary as of python3.3
102
    # Python standard libarary as of python3.3
103
    import ipaddress
103
    import ipaddress
104
except ImportError:
104
except ImportError:
105
    try:
105
    print('ipaddress module required: https://github.com/phihag/ipaddress')
106
        import ipaddr as ipaddress
107
    except ImportError:
108
        print('ipaddr module required: http://code.google.com/p/ipaddr-py/')
109
106
110
import DNS    # http://pydns.sourceforge.net
107
import DNS    # http://pydns.sourceforge.net
111
if not hasattr(DNS.Type, 'SPF'):
108
if not hasattr(DNS.Type, 'SPF'):
Lines 401-406 Link Here
401
            self.iplist = []
398
            self.iplist = []
402
            ip6 = True
399
            ip6 = True
403
        else:
400
        else:
401
            if sys.version_info.major < 3:
402
                if isinstance(i, str):
403
                   i = i.decode('ascii')
404
            try:
404
            try:
405
                self.ipaddr = ipaddress.ip_address(i)
405
                self.ipaddr = ipaddress.ip_address(i)
406
            except AttributeError:
406
            except AttributeError:
Lines 1203-1209 Link Here
1203
                    'No %s records found for'%A, domainname)
1203
                    'No %s records found for'%A, domainname)
1204
        if A == 'AAAA' and bytes is str:
1204
        if A == 'AAAA' and bytes is str:
1205
          # work around pydns inconsistency plus python2 bytes/str ambiguity
1205
          # work around pydns inconsistency plus python2 bytes/str ambiguity
1206
          return [ipaddress.Bytes(ip) for ip in r]
1206
          return [ipaddress.ip_address(ip) for ip in r]
1207
        return r
1207
        return r
1208
1208
1209
    def validated_ptrs(self):
1209
    def validated_ptrs(self):
Lines 1345-1350 Link Here
1345
        True
1345
        True
1346
        """
1346
        """
1347
        try:
1347
        try:
1348
            if sys.version_info.major < 3:
1349
                for idx, ip in enumerate(ipaddrs):
1350
                    if isinstance(ipaddrs[idx], str):
1351
                        ipaddrs[idx] = ipaddrs[idx].decode('ascii')
1352
1348
            for netwrk in [ipaddress.ip_network(ip) for ip in ipaddrs]:
1353
            for netwrk in [ipaddress.ip_network(ip) for ip in ipaddrs]:
1349
                network = netwrk.supernet(new_prefix=n)
1354
                network = netwrk.supernet(new_prefix=n)
1350
                if isinstance(self.iplist, bool):
1355
                if isinstance(self.iplist, bool):

Return to bug 559366