--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: openerp-server: database creation fails if server has no locale set.
- From: Roger Gammans <rgammans@computer-surgery.co.uk>
- Date: Fri, 08 Oct 2010 11:40:29 +0100
- Message-id: <20101008104029.30362.61538.reportbug@moore.fordcombe.chilstone.com>
Package: openerp-server
Version: 5.0.12-2
Severity: important
If the server process's environment does not have a locale set
database creation fails. This may be the root cause of #587946 .
When you try to create a database the following exception with
traceback is generated:-
DEBUG:exception:u'expected string or buffer'
DEBUG:traceback:'Traceback (most recent call last):
File "/usr/share/pyshared/openerp-server/netsvc.py", line 247, in dispatch
result = LocalService(service_name)(method, *params)
File "/usr/share/pyshared/openerp-server/netsvc.py", line 76, in __call__
return getattr(self, method)(*params)
File "/usr/share/pyshared/openerp-server/service/web_services.py", line 89, in create
self._create_empty_database(db_name)
File "/usr/share/pyshared/openerp-server/service/web_services.py", line 68, in _create_empty_database
if re.search(\'utf|UTF\', locale.getdefaultlocale()[1]):
File "/usr/lib/python2.5/re.py", line 142, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or buffer\n'
We can confirm this is a local problem by looking at the result
of locale.getdefaultlocale() in different environments.
~# python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> repr( locale.getdefaultlocale()[1])
'None'
>>>
~# LANG=en python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> repr( locale.getdefaultlocale()[1])
"'ISO8859-1'"
>>>
This could be fixed by forcing a LANG= setting in the init script , or
a patch like the one that follows.
--- web_services.py.orig 2010-10-08 11:04:09.000000000 +0100
+++ web_services.py 2010-10-08 11:05:50.000000000 +0100
@@ -65,6 +65,7 @@
self._pg_psw_env_var_is_set = False # on win32, pg_dump need the PGPASSWORD env var
def _create_empty_database(self, name):
+ localecode = locale.getdefaultlocale()[1] or ""
if re.search('utf|UTF', locale.getdefaultlocale()[1]):
db_encoding = 'unicode'
-- System Information:
Debian Release: 5.0.6
APT prefers stable
APT policy: (500, 'stable'), (20, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages openerp-server depends on:
ii adduser 3.110 add and remove users and groups
ii debconf [debconf-2.0] 1.5.24 Debian configuration management sy
ii python 2.5.2-3 An interactive high-level object-o
ii python-libxslt1 1.1.24-2 Python bindings for libxslt1
ii python-lxml 2.1.1-2.1 pythonic binding for the libxml2 a
ii python-psycopg2 2.0.7-4 Python module for PostgreSQL
ii python-pychart 1.39-6 Python library for creating high q
ii python-pydot 1.0.2-1 Python interface to Graphviz's dot
ii python-reportlab 2.1dfsg-2 ReportLab library to create PDF do
ii python-tz 2008c-2 Python version of the Olson timezo
Versions of packages openerp-server recommends:
ii ghostscript 8.62.dfsg.1-3.2lenny5 The GPL Ghostscript PostScript/PDF
ii graphviz 2.20.2-3 rich set of graph drawing tools
ii postgresql 8.3.11-0lenny1 object-relational SQL database (su
ii postgresql-client- 8.3.11-0lenny1 front-end programs for PostgreSQL
ii python-imaging 1.1.6-3 Python Imaging Library
ii python-matplotlib 0.98.1-1+lenny4 Python based plotting system in a
ii python-openssl 0.7-2 Python wrapper around the OpenSSL
ii python-pyparsing 1.5.0-1 Python parsing module
Versions of packages openerp-server suggests:
pn openerp-client <none> (no description available)
-- debconf information excluded
--- End Message ---