[Python-checkins] CVS: python/dist/src/Lib locale.py,1.8,1.9
Fredrik Lundh
python-dev@python.org
Sun, 9 Jul 2000 16:16:13 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv32044/Lib
Modified Files:
locale.py
Log Message:
- repaired locale.py for non-windows platforms. the try/except
checked for the wrong exception. my fault. sorry.
(first reported by Alex Coventry)
Index: locale.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/locale.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** locale.py 2000/07/09 17:12:58 1.8
--- locale.py 2000/07/09 23:16:10 1.9
***************
*** 283,296 ****
"""
try:
# check if it's supported by the _locale module
import _locale
code, encoding = _locale._getdefaultlocale()
if sys.platform == "win32" and code and code[:2] == "0x":
# map windows language identifier to language name
code = windows_locale.get(int(code, 0))
return code, encoding
! except (ImportError, NameError):
! pass
# fall back on POSIX behaviour
import os
--- 283,299 ----
"""
+
try:
# check if it's supported by the _locale module
import _locale
code, encoding = _locale._getdefaultlocale()
+ except (ImportError, AttributeError):
+ pass
+ else:
if sys.platform == "win32" and code and code[:2] == "0x":
# map windows language identifier to language name
code = windows_locale.get(int(code, 0))
return code, encoding
!
# fall back on POSIX behaviour
import os