[trunk] unsupported locale with Python 2.4
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Used same trunk version as in https:/
In Python 2.4 there is a bug on the locale settings, especially on resetting the locale. See http://
So updating the database gave me the error:
[Wed Jan 28 2009 15:59:53] INFO:init:module base: loading security/
[Wed Jan 28 2009 15:59:54] INFO:init:module base: loading maintenance/
[Wed Jan 28 2009 15:59:54] INFO:init:module base: loading security/
[Wed Jan 28 2009 16:00:04] INFO:init:module base: loading translation file for language nl_NL
Traceback (most recent call last):
File "./openerp-
pooler.
File "/opt/server/
addons.
File "/opt/server/
load_
File "/opt/server/
modobj.
File "/opt/server/
tools.
File "/opt/server/
r = trans_load_
File "/opt/server/
locale.
File "/usr/lib/
_setlocale(
locale.Error: unsupported locale setting
-bash-3.2$
I'm trying to load the Dutch translation, but this doesn't work.
Go into the python console and do some locale settings on CentOS:
Python 2.4.3 (#1, May 24 2008, 13:47:28)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.
('en_US', 'utf')
>>> locale.
'en_US.utf'
>>> locale.resetlocale
<function resetlocale at 0xb7eb13ac>
>>> locale.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/
_setlocale(
locale.Error: unsupported locale setting
>>>
Doing the same on Fedora 10 gave me:
Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.
('en_US', 'UTF8')
>>> locale.
'en_US.UTF8'
>>> locale.
>>>
As you can see, python 2.5 gives me the right encoding, python 2.4 give me the wrong encoding back (utf instead of UTF8).
On this moment I fixed this by backup the locale.py locale.pyo and locale.pyc of python 2.4 and copy the same files from python 2.5 into /usr/lib/python2.4, which fixed this, but it's better to get a workaround in OpenERP.
Updated everything to trunk version:
Tree is up to date at revision 2171.
Tree is up to date at revision 1664.
Tree is up to date at revision 915.
Tree is up to date at revision 2219.
Looks good, BUT after loading the translation file the locale is set to that language. In my case it's Dutch. (don't look at the time, the time on the server isn't correct. It's just a testserver)
[Wed Jan 28 2009 16:25:22] INFO:init:module base: loading security/ base_security. xml maintenance_ view.xml ir.model. access. csv
[Wed Jan 28 2009 16:25:22] INFO:init:module base: loading maintenance/
[Wed Jan 28 2009 16:25:23] INFO:init:module base: loading security/
[Wed Jan 28 2009 16:25:31] INFO:init:module base: loading translation file for language nl_NL
[wo jan 28 2009 16:26:25] INFO:init:updating modules list
[wo jan 28 2009 16:27:07] INFO:init:module base: loading objects
[wo jan 28 2009 16:27:07] INFO:init:module process: registering objects
This shouldn't be happen.