summaryrefslogtreecommitdiffstats
path: root/ipapython/ssh.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2015-09-11 13:43:28 +0200
committerJan Cholasta <jcholast@redhat.com>2015-09-17 11:08:43 +0200
commit23507e6124041ed17f39db211e802495e37520e7 (patch)
tree8cf010848183a977fde0d5cdcd653556d215cd62 /ipapython/ssh.py
parent1550b5ab50966387bac19f46b34a2107010d08d4 (diff)
downloadfreeipa-23507e6124041ed17f39db211e802495e37520e7.tar.gz
freeipa-23507e6124041ed17f39db211e802495e37520e7.tar.xz
freeipa-23507e6124041ed17f39db211e802495e37520e7.zip
Alias "unicode" to "str" under Python 3
The six way of doing this is to replace all occurences of "unicode" with "six.text_type". However, "unicode" is non-ambiguous and (arguably) easier to read. Also, using it makes the patches smaller, which should help with backporting. Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'ipapython/ssh.py')
-rw-r--r--ipapython/ssh.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/ipapython/ssh.py b/ipapython/ssh.py
index c95488928..c8d8306f2 100644
--- a/ipapython/ssh.py
+++ b/ipapython/ssh.py
@@ -28,6 +28,11 @@ import struct
from hashlib import md5, sha1
from hashlib import sha256 #pylint: disable=E0611
+import six
+
+if six.PY3:
+ unicode = str
+
__all__ = ['SSHPublicKey']
OPENSSH_BASE_REGEX = re.compile(r'^[\t ]*(?P<keytype>[^\x00\n\r]+?) [\t ]*(?P<key>[^\x00\n\r]+?)(?:[\t ]+(?P<comment>[^\x00\n\r]*?)[\t ]*)?$')