Package: openerp-server
Version: 5.0.10-1
Severity: important
Tags: sid patch squeeze

After installing openerp-server, openerp-client, & posgresql, then creating the
required postrgresql user openerp, I opened openerp-client and got the
expected:
"No database found, you must create one !"
message.
Selecting File -> Databases -> New database, filling in the fields and clicking
OK results in the error message:
Error during database creation ! Could not create database.

var/log/postgresql/postgresql-8.4-main.log contains:
2010-06-07 19:54:34 EDT ERROR:  encoding UTF8 does not match locale en_US
2010-06-07 19:54:34 EDT DETAIL:  The chosen LC_CTYPE setting requires \
encoding LATIN1. 2010-06-07
19:54:34 EDT STATEMENT:  CREATE DATABASE "mytestdb" ENCODING 'unicode' \
TEMPLATE "template0"

Some research found that the database encoding when creating a new
database is hard-coded in openerp-server to 'unicode'. Postgresql accepts
unicode if the locale (when postgresql is installed) is a UTF type or the C
locale but it only accepts LATIN1 if another locale type is found.

The attached patch queries the locale and sets the encoding for database
creation accordingly.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages openerp-server depends on:
ii  adduser                       3.112      add and remove users and groups
ii debconf [debconf-2.0] 1.5.29 Debian configuration management sy ii python 2.5.4-9 An interactive high-level object-o
ii  python-libxslt1               1.1.26-3   Python bindings for libxslt1
ii python-lxml 2.2.6-1 pythonic binding for the libxml2 a
ii  python-psycopg2               2.0.14-1   Python module for PostgreSQL
ii python-pychart 1.39-7 Python library for creating high q ii python-pydot 1.0.2-1 Python interface to Graphviz's dot ii python-reportlab 2.4-1 ReportLab library to create PDF do ii python-tz 2010b-1 Python version of the Olson timezo

Versions of packages openerp-server recommends:
ii ghostscript 8.71~dfsg-3 The GPL Ghostscript PostScript/PDF
ii  graphviz                     2.26.3-4    rich set of graph drawing tools
ii postgresql 8.4.4-1 object-relational SQL database (su ii postgresql-client-8.4 [postg 8.4.4-1 front-end programs for PostgreSQL
ii  python-imaging               1.1.7-1+b1  Python Imaging Library
ii python-matplotlib 0.99.1.2-3 Python based plotting system in a ii python-openssl 0.10-1 Python wrapper around the OpenSSL
ii  python-pyparsing             1.5.2-2     Python parsing module

Versions of packages openerp-server suggests:
ii openerp-client 5.0.10-1 Enterprise Resource Management (cl

-- debconf-show failed

Author: Timothy E. Harris <[email protected]>
Description: Fix bug that prevents creating a new database if the locale is not a UTF-8 one.

Index: openerp-server-5.0.10/bin/service/web_services.py
===================================================================
--- openerp-server-5.0.10.orig/bin/service/web_services.py	2010-06-06 10:00:23.000000000 -0400
+++ openerp-server-5.0.10/bin/service/web_services.py	2010-06-06 10:01:26.000000000 -0400
@@ -38,6 +38,7 @@
 import sql_db
 import tools
 import locale
+import re
 from cStringIO import StringIO
 
 logging.basicConfig()
@@ -64,11 +65,15 @@
         self._pg_psw_env_var_is_set = False # on win32, pg_dump need the PGPASSWORD env var
 
     def _create_empty_database(self, name):
+        if re.search('utf|UTF', locale.getdefaultlocale()[1]):
+            db_encoding = 'unicode'
+        else:
+            db_encoding = 'LATIN1'
         db = sql_db.db_connect('template1')
         cr = db.cursor()
         try:
             cr.autocommit(True) # avoid transaction block
-            cr.execute("""CREATE DATABASE "%s" ENCODING 'unicode' TEMPLATE "template0" """ % name)
+            cr.execute("""CREATE DATABASE "%s" ENCODING '%s' TEMPLATE "template0" """ %(name, db_encoding))
         finally:
             cr.close()
 
_______________________________________________
open-object mailing list
[email protected]
http://lists.debian-maintainers.org/listinfo/open-object

Reply via email to