#5935 [py3] DNSName.ToASCII broken with python3
Closed: Fixed None Opened 5 years ago by dkupka.

Steps to reproduce:

$ python3
>>> from ipapython.dnsutil import DNSName
>>> DNSName(u'ýšáěíčýáíšěčýáíšěýáíčšěýčáíšěýáíčý.com').ToASCII()

Expected:

u'xn--1caaaaaa3fbbbbb0rcccccc81adgbf34afeee19rhafff.com'

Got:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/site-packages/ipapython/dnsutil.py", line 74, in ToASCII
    return self.to_text().decode('ascii')  # must be unicode string
AttributeError: 'str' object has no attribute 'decode'

This works with python2.


This ticket is out of scope of 4.4.0 release. Moving to 4.4.1. Note that 4.4.1 needs to be triaged, therefore not everything will be implemented.

This was fixed in master branch of dnspython https://github.com/rthalley/dnspython/blob/master/dns/name.py#L375

        s = b'.'.join(map(_escapify, l))
        return s

Now, it always returns binary string so this should be always decoded, because IPA internals need punycoded string decoded to unicode.

Keeping as tracker until a new dnspython is released

Moving to next major version. Fixing this bug is not critical in stabilization release.

JFTR: it looks that dnspython changed implementation again, so proposed fix, don't do anything, doesn't work anymore.

master:

Metadata Update from @dkupka:
- Issue assigned to mbasti
- Issue set to the milestone: FreeIPA 4.5

5 years ago

Login to comment on this ticket.

Metadata