diff options
author | Casey Deccio <casey@deccio.net> | 2016-12-22 00:28:42 +0300 |
---|---|---|
committer | Casey Deccio <casey@deccio.net> | 2017-06-15 23:34:51 +0300 |
commit | 0105b679e8b6311bbc7455a9d7f46ca66037bb43 (patch) | |
tree | 65dafaca14053b748cbcb46999003d79d85462f2 | |
parent | 6564ccd30a71a1116b38831a6d2e1432c38e2765 (diff) |
Fix python3 compatibility issue with dnspython 1.15.0 release
-rw-r--r-- | dnsviz/format.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dnsviz/format.py b/dnsviz/format.py index db179cf..0067a67 100644 --- a/dnsviz/format.py +++ b/dnsviz/format.py @@ -168,5 +168,10 @@ def humanize_name(name, idn=False): return name.rstrip('.') def latin1_binary_to_string(s): - return codecs.decode(s, 'latin1') + # python3/python2 dual compatibility + #XXX In places where this method wraps calls to dns.name.Name.to_text(), + # this is no longer needed with dnspython 1.15.0 + if isinstance(s, bytes): + return codecs.decode(s, 'latin1') + return s lb2s = latin1_binary_to_string |