Commit 663809ed authored by Fredrik Lundh's avatar Fredrik Lundh

-- removed get_default compatibility kludge

-- added a few extra comments to locale.py
parent dde61644
...@@ -290,9 +290,12 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): ...@@ -290,9 +290,12 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
except (ImportError, AttributeError): except (ImportError, AttributeError):
pass pass
else: else:
# make sure the code/encoding values are valid
if sys.platform == "win32" and code and code[:2] == "0x": if sys.platform == "win32" and code and code[:2] == "0x":
# map windows language identifier to language name # map windows language identifier to language name
code = windows_locale.get(int(code, 0)) code = windows_locale.get(int(code, 0))
# ...add other platform-specific processing here, if
# necessary...
return code, encoding return code, encoding
# fall back on POSIX behaviour # fall back on POSIX behaviour
...@@ -306,8 +309,6 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): ...@@ -306,8 +309,6 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
localename = 'C' localename = 'C'
return _parse_localename(localename) return _parse_localename(localename)
# compatibility
get_default = getdefaultlocale
def getlocale(category=LC_CTYPE): def getlocale(category=LC_CTYPE):
......
...@@ -126,7 +126,7 @@ del exit ...@@ -126,7 +126,7 @@ del exit
# #
def locale_aware_defaultencoding(): def locale_aware_defaultencoding():
import locale import locale
code, encoding = locale.get_default() code, encoding = locale.getdefaultlocale()
if encoding is None: if encoding is None:
encoding = 'ascii' encoding = 'ascii'
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment