-- removed get_default compatibility kludge

-- added a few extra comments to locale.py
This commit is contained in:
Fredrik Lundh 2000-07-10 19:32:19 +00:00
parent dde6164402
commit 663809ed83
2 changed files with 4 additions and 3 deletions

View File

@ -290,9 +290,12 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
except (ImportError, AttributeError):
pass
else:
# make sure the code/encoding values are valid
if sys.platform == "win32" and code and code[:2] == "0x":
# map windows language identifier to language name
code = windows_locale.get(int(code, 0))
# ...add other platform-specific processing here, if
# necessary...
return code, encoding
# fall back on POSIX behaviour
@ -306,8 +309,6 @@ def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')):
localename = 'C'
return _parse_localename(localename)
# compatibility
get_default = getdefaultlocale
def getlocale(category=LC_CTYPE):

View File

@ -126,7 +126,7 @@ del exit
#
def locale_aware_defaultencoding():
import locale
code, encoding = locale.get_default()
code, encoding = locale.getdefaultlocale()
if encoding is None:
encoding = 'ascii'
try: