Merge lp:~sharoonthomas/openobject-server/patchfor_postgressql_environnonutf8 into lp:openobject-server/5.0

Proposed by Sharoon Thomas http://openlabs.co.in
Status: Merged
Merge reported by: Christophe Simonis (OpenERP)
Merged at revision: not available
Proposed branch: lp:~sharoonthomas/openobject-server/patchfor_postgressql_environnonutf8
Merge into: lp:openobject-server/5.0
Diff against target: 12 lines (+1/-1)
1 file modified
bin/service/web_services.py (+1/-1)
To merge this branch: bzr merge lp:~sharoonthomas/openobject-server/patchfor_postgressql_environnonutf8
Reviewer Review Type Date Requested Status
Christophe Simonis (OpenERP) Approve
Christophe CHAUVET (community) Approve
Review via email: mp+17222@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

If the postgres cluster is on a different encoding or no environment is
specified then the database created will be of encoding SQL_ASCII
(Refer:http://www.postgresql.org/docs/8.4/static/multibyte.html)

Hence template1 will use the specified encoding which is not UTF8.

Line 80 of webservices.py has a simple create command which will err out
in such a situation.

It has to change from:

cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\'' % db_name)
to
cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\' TEMPLATE template0' % db_name)

if not the error would be:

new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT: Use the same encoding as in the template database, or use template0 as template.

*** Apologies for the last merge proposal. It had my local settings too.

1930. By Sharoon Thomas http://openlabs.co.in

[IMP]Wrong location of quote

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

Good point,

Regards,

review: Approve
Revision history for this message
Christophe Simonis (OpenERP) (kangol) wrote :

I approve the patch
But that change has already been made by this commit:
http://bazaar.launchpad.net/~<email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/service/web_services.py'
2--- bin/service/web_services.py 2010-01-06 06:33:08 +0000
3+++ bin/service/web_services.py 2010-01-12 12:41:13 +0000
4@@ -77,7 +77,7 @@
5 cr = db.cursor()
6 try:
7 cr.autocommit(True) # avoid transaction block
8- cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\'' % db_name)
9+ cr.execute('CREATE DATABASE "%s" ENCODING \'unicode\' TEMPLATE template0' % db_name)
10 finally:
11 cr.close()
12 finally: