[master 12/30] Make ASCII conversions Python compatible (#1014220)
M4rtinK
installerbot-noreply at redhat.com
Mon Jun 1 14:04:29 UTC 2015
From: Martin Kolman <mkolman at redhat.com>
Also fix the normalisation method string - it should be
"NFKD", not "NKFD".
---
pyanaconda/iutil.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index c059629..e91f2d2 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -35,6 +35,7 @@
from urllib import quote, unquote
import gettext
import signal
+import sys
import requests
from requests_file import FileAdapter
@@ -1080,8 +1081,8 @@ def is_unsupported_hw():
# Define translations between ASCII uppercase and lowercase for
# locale-independent string conversions. The tables are 256-byte string used
-# with string.translate. If string.translate is used with a unicode string,
-# even if the string contains only 7-bit characters, string.translate will
+# with str.translate. If str.translate is used with a unicode string,
+# even if the string contains only 7-bit characters, str.translate will
# raise a UnicodeDecodeError.
_ASCIIupper_table = string.maketrans(string.ascii_lowercase, string.ascii_uppercase)
_ASCIIlower_table = string.maketrans(string.ascii_uppercase, string.ascii_lowercase)
@@ -1094,8 +1095,8 @@ def _toASCII(s):
# compatibility equivalence (e.g., ROMAN NUMERAL ONE has its own code
# point but it's really just a capital I), so that we can keep as much
# of the ASCII part of the string as possible.
- s = unicodedata.normalize('NKFD', s).encode('ascii', 'ignore')
- elif not isinstance(s, types.StringType):
+ s = unicodedata.normalize('NFKD', s).encode('ascii', 'ignore').decode("ascii")
+ elif type(s) != bytes:
s = ''
return s
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/5cb6e4be764cbc4e997ebc69d0eec3509b6b4b3b
More information about the anaconda-patches
mailing list