Server raise exception when creating database in non-english

Bug #524588 reported by Ivan Gudym
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Christophe Simonis (OpenERP)

Bug Description

When creating database in ukrainian got error in ustr function
Revering bin/tools/misc.py to revision prior 1977 helps.

Related branches

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

Can you paste your stack trace?

Changed in openobject-server:
status: New → Incomplete
Revision history for this message
Ivan Gudym (igudym) wrote :
Download full text (4.3 KiB)

[2010-02-20 11:56:26,099] INFO:i18n:module base: loading translation file for language uk_UA
[2010-02-20 11:56:26,721] ERROR:web-services:[01]:
[2010-02-20 11:56:26,722] ERROR:web-services:[02]: Environment Information :
[2010-02-20 11:56:26,722] ERROR:web-services:[03]: System : Linux-2.6.30.10-105.2.23.fc11.i686.PAE-i686-with-fedora-11-Leonidas
[2010-02-20 11:56:26,722] ERROR:web-services:[04]: OS Name : posix
[2010-02-20 11:56:26,722] ERROR:web-services:[05]: LSB Version: :core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:desktop-3.1-ia32:desktop-3.1-noarch:desktop-3.2-ia32:desktop-3.2-noarch
[2010-02-20 11:56:26,723] ERROR:web-services:[06]: Distributor ID: Fedora
[2010-02-20 11:56:26,723] ERROR:web-services:[07]: Description: Fedora release 11 (Leonidas)
[2010-02-20 11:56:26,723] ERROR:web-services:[08]: Release: 11
[2010-02-20 11:56:26,723] ERROR:web-services:[09]: Codename: Leonidas
[2010-02-20 11:56:26,724] ERROR:web-services:[10]: Operating System Release : 2.6.30.10-105.2.23.fc11.i686.PAE
[2010-02-20 11:56:26,724] ERROR:web-services:[11]: Operating System Version : #1 SMP Thu Feb 11 07:05:37 UTC 2010
[2010-02-20 11:56:26,724] ERROR:web-services:[12]: Operating System Architecture : 32bit
[2010-02-20 11:56:26,724] ERROR:web-services:[13]: Operating System Locale : uk_UA.UTF8
[2010-02-20 11:56:26,725] ERROR:web-services:[14]: Python Version : 2.6.0
[2010-02-20 11:56:26,725] ERROR:web-services:[15]: OpenERP-Server Version : 5.0.7
[2010-02-20 11:56:26,725] ERROR:web-services:[16]: Last revision No. & ID : 1962 ivan_gudym-20100220094648-euw0u3dluxfwwe0e
[2010-02-20 11:56:26,725] ERROR:web-services:[17]:
[2010-02-20 11:56:26,726] ERROR:web-services:[18]: CREATE DATABASE
[2010-02-20 11:56:26,726] ERROR:web-services:[19]: Traceback (most recent call last):
[2010-02-20 11:56:26,726] ERROR:web-services:[20]: File "/home/ivan/devel/openerp/oerpua-fop/server/bin/service/web_services.py", line 104, in __call__
[2010-02-20 11:56:26,726] ERROR:web-services:[21]: modobj.update_translations(cr, 1, mids, lang)
[2010-02-20 11:56:26,727] ERROR:web-services:[22]: File "/home/ivan/devel/openerp/oerpua-fop/server/bin/addons/base/module/module.py", line 484, in update_translations
[2010-02-20 11:56:26,727] ERROR:web-services:[23]: tools.trans_load(cr.dbname, f, lang, verbose=False)
[2010-02-20 11:56:26,727] ERROR:web-services:[24]: File "/home/ivan/devel/openerp/oerpua-fop/server/bin/tools/translate.py", line 615, in trans_load
[2010-02-20 11:56:26,727] ERROR:web-services:[25]: r = trans_load_data(db_name, fileobj, fileformat, lang, strict=strict, verbose=verbose)
[2010-02-20 11:56:26,728] ERROR:web-services:[26]: File "/home/ivan/devel/openerp/oerpua-fop/server/bin/tools/translate.py", line 665, in trans_load_data
[2010-02-20 11:56:26,728] ERROR:web-services:[27]: lang_obj.create(cr, uid, lang_info)
[2010-02-20 11:56:26,728] ERROR:web-services:[28]: File "/home/ivan/devel/openerp/oerpua-fop/server/bin/osv/orm.py", line 2766, in create
[2010-02-20 11:56:26,728] ERROR:web-services:[29]: upd2.append(self._columns[field]._symbol_set[1](vals[field]))
[2010-02-20 11:56:26,729] ERROR:web-services:[30]: File "/home/iva...

Read more...

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

I could not generate any such error with Ukranian Language.
I guess its the problem with py2.6.
Thanks.

Revision history for this message
Ivan Gudym (igudym) wrote :

It's very strange.
I pull new copy of OpenERP into new location and try to create new database. Yes, I did it even on another box. Choose Language - Ukrainian, Load demonstration data - yes. And ... oops. The same error.

Revision history for this message
Ivan Gudym (igudym) wrote :
Download full text (4.1 KiB)

[2010-02-22 11:37:44,826] INFO:i18n:module base: loading translation file for language uk_UA
[2010-02-22 11:37:49,240] ERROR:web-services:[01]:
[2010-02-22 11:37:49,240] ERROR:web-services:[02]: Environment Information :
[2010-02-22 11:37:49,241] ERROR:web-services:[03]: System : Linux-2.6.31.12-174.2.19.fc12.i686-i686-with-fedora-12-Constantine
[2010-02-22 11:37:49,241] ERROR:web-services:[04]: OS Name : posix
[2010-02-22 11:37:49,241] ERROR:web-services:[05]: LSB Version: :core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:desktop-3.1-ia32:desktop-3.1-noarch:desktop-3.2-ia32:desktop-3.2-noarch
[2010-02-22 11:37:49,241] ERROR:web-services:[06]: Distributor ID: Fedora
[2010-02-22 11:37:49,242] ERROR:web-services:[07]: Description: Fedora release 12 (Constantine)
[2010-02-22 11:37:49,242] ERROR:web-services:[08]: Release: 12
[2010-02-22 11:37:49,242] ERROR:web-services:[09]: Codename: Constantine
[2010-02-22 11:37:49,242] ERROR:web-services:[10]: Operating System Release : 2.6.31.12-174.2.19.fc12.i686
[2010-02-22 11:37:49,243] ERROR:web-services:[11]: Operating System Version : #1 SMP Thu Feb 11 07:39:11 UTC 2010
[2010-02-22 11:37:49,243] ERROR:web-services:[12]: Operating System Architecture : 32bit
[2010-02-22 11:37:49,243] ERROR:web-services:[13]: Operating System Locale : uk_UA.UTF8
[2010-02-22 11:37:49,243] ERROR:web-services:[14]: Python Version : 2.6.2
[2010-02-22 11:37:49,244] ERROR:web-services:[15]: OpenERP-Server Version : 5.0.7
[2010-02-22 11:37:49,244] ERROR:web-services:[16]: Last revision No. & ID : 1982 <email address hidden>
[2010-02-22 11:37:49,244] ERROR:web-services:[17]:
[2010-02-22 11:37:49,245] ERROR:web-services:[18]: CREATE DATABASE
[2010-02-22 11:37:49,245] ERROR:web-services:[19]: Traceback (most recent call last):
[2010-02-22 11:37:49,245] ERROR:web-services:[20]: File "/home/user/devel/test/openerp/server/bin/service/web_services.py", line 104, in __call__
[2010-02-22 11:37:49,245] ERROR:web-services:[21]: modobj.update_translations(cr, 1, mids, lang)
[2010-02-22 11:37:49,246] ERROR:web-services:[22]: File "/home/user/devel/test/openerp/server/bin/addons/base/module/module.py", line 484, in update_translations
[2010-02-22 11:37:49,246] ERROR:web-services:[23]: tools.trans_load(cr.dbname, f, lang, verbose=False)
[2010-02-22 11:37:49,246] ERROR:web-services:[24]: File "/home/user/devel/test/openerp/server/bin/tools/translate.py", line 615, in trans_load
[2010-02-22 11:37:49,246] ERROR:web-services:[25]: r = trans_load_data(db_name, fileobj, fileformat, lang, strict=strict, verbose=verbose)
[2010-02-22 11:37:49,247] ERROR:web-services:[26]: File "/home/user/devel/test/openerp/server/bin/tools/translate.py", line 665, in trans_load_data
[2010-02-22 11:37:49,247] ERROR:web-services:[27]: lang_obj.create(cr, uid, lang_info)
[2010-02-22 11:37:49,247] ERROR:web-services:[28]: File "/home/user/devel/test/openerp/server/bin/osv/orm.py", line 2765, in create
[2010-02-22 11:37:49,247] ERROR:web-services:[29]: upd2.append(self._columns[field]._symbol_set[1](vals[field]))
[2010-02-22 11:37:49,248] ERROR:web-services:[30]: File "/home/user/devel/test/openerp/ser...

Read more...

Revision history for this message
Ivan Gudym (igudym) wrote :

And, Jay, don't look to "DeprecationWarning". This is not a source of error. Such as previous "WARNING:sql:[01]: Cursor not closed explicitly" too. Real source of error is this: "ERROR:web-services:[34]: UnicodeError: unable de to convert '\xc2\xc2\xa0'".

Deprecation warning is just a result of incorrect (old-style) exception processing but not the reason of exception itself.
So this deprecation warning do not link together any bugs.

Revision history for this message
Parthiv Patel (parthiv-patel-deactivatedaccount) wrote : Re: [Bug 524588] Re: Server raise exception when creating database in non-english
Download full text (4.9 KiB)

can you please tell what is the cluster / database encoding format ?

On Mon, Feb 22, 2010 at 3:17 PM, Ivan Gudym <email address hidden> wrote:

> *** This bug is a duplicate of bug 506427 ***
> https://bugs.launchpad.net/bugs/506427
>
> [2010-02-22 11:37:44,826] INFO:i18n:module base: loading translation file
> for language uk_UA
> [2010-02-22 11:37:49,240] ERROR:web-services:[01]:
> [2010-02-22 11:37:49,240] ERROR:web-services:[02]: Environment Information
> :
> [2010-02-22 11:37:49,241] ERROR:web-services:[03]: System :
> Linux-2.6.31.12-174.2.19.fc12.i686-i686-with-fedora-12-Constantine
> [2010-02-22 11:37:49,241] ERROR:web-services:[04]: OS Name : posix
> [2010-02-22 11:37:49,241] ERROR:web-services:[05]: LSB Version:
> :core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:desktop-3.1-ia32:desktop-3.1-noarch:desktop-3.2-ia32:desktop-3.2-noarch
> [2010-02-22 11:37:49,241] ERROR:web-services:[06]: Distributor ID:
> Fedora
> [2010-02-22 11:37:49,242] ERROR:web-services:[07]: Description: Fedora
> release 12 (Constantine)
> [2010-02-22 11:37:49,242] ERROR:web-services:[08]: Release: 12
> [2010-02-22 11:37:49,242] ERROR:web-services:[09]: Codename: Constantine
> [2010-02-22 11:37:49,242] ERROR:web-services:[10]: Operating System Release
> : 2.6.31.12-174.2.19.fc12.i686
> [2010-02-22 11:37:49,243] ERROR:web-services:[11]: Operating System Version
> : #1 SMP Thu Feb 11 07:39:11 UTC 2010
> [2010-02-22 11:37:49,243] ERROR:web-services:[12]: Operating System
> Architecture : 32bit
> [2010-02-22 11:37:49,243] ERROR:web-services:[13]: Operating System Locale
> : uk_UA.UTF8
> [2010-02-22 11:37:49,243] ERROR:web-services:[14]: Python Version : 2.6.2
> [2010-02-22 11:37:49,244] ERROR:web-services:[15]: OpenERP-Server Version :
> 5.0.7
> [2010-02-22 11:37:49,244] ERROR:web-services:[16]: Last revision No. & ID :
> 1982 <email address hidden>
> [2010-02-22 11:37:49,244] ERROR:web-services:[17]:
> [2010-02-22 11:37:49,245] ERROR:web-services:[18]: CREATE DATABASE
> [2010-02-22 11:37:49,245] ERROR:web-services:[19]: Traceback (most recent
> call last):
> [2010-02-22 11:37:49,245] ERROR:web-services:[20]: File
> "/home/user/devel/test/openerp/server/bin/service/web_services.py", line
> 104, in __call__
> [2010-02-22 11:37:49,245] ERROR:web-services:[21]:
> modobj.update_translations(cr, 1, mids, lang)
> [2010-02-22 11:37:49,246] ERROR:web-services:[22]: File
> "/home/user/devel/test/openerp/server/bin/addons/base/module/module.py",
> line 484, in update_translations
> [2010-02-22 11:37:49,246] ERROR:web-services:[23]:
> tools.trans_load(cr.dbname, f, lang, verbose=False)
> [2010-02-22 11:37:49,246] ERROR:web-services:[24]: File
> "/home/user/devel/test/openerp/server/bin/tools/translate.py", line 615, in
> trans_load
> [2010-02-22 11:37:49,246] ERROR:web-services:[25]: r =
> trans_load_data(db_name, fileobj, fileformat, lang, strict=strict,
> verbose=verbose)
> [2010-02-22 11:37:49,247] ERROR:web-services:[26]: File
> "/home/user/devel/test/openerp/server/bin/tools/translate.py", line 665, in
> trans_load_data
> [2010-02-22 11:37:49,247] ERROR:web-services:[27]: lang_obj.create(cr,
> uid, lang_info)
> ...

Read more...

Revision history for this message
Stephane Wirtel (OpenERP) (stephane-openerp) wrote :

I'm testing the Ukrainian Language with the current stable.

But I have an English environment.

Revision history for this message
Stephane Wirtel (OpenERP) (stephane-openerp) wrote :

Hi,

I checked with python2.5 and python2.6
English Environment for the OS. but I just created the database with the Ukrainian language
Database Encoding: UTF-8

Conclusion: I can't reproduce your bug.

Can you provide complementary information about this bug ?

Thanks

Revision history for this message
Stephane Wirtel (OpenERP) (stephane-openerp) wrote :

And what's your version ? Thanks

Revision history for this message
Ivan Gudym (igudym) wrote :

Stephane, last version loaded by bzr_set, it printed in error log: [2010-02-22 11:37:49,244] ERROR:web-services:[16]: Last revision No. & ID : 1982 <email address hidden>

Revision history for this message
Parthiv Patel (parthiv-patel-deactivatedaccount) wrote :

I think Ivan Gudym is having Latin or some other database encoding than
UTF-8, that's why the problem occurs.

On Mon, Feb 22, 2010 at 3:40 PM, Stephane (Open ERP) <email address hidden>wrote:

> And what's your version ? Thanks
>
> --
> Server raise exception when creating database in non-english
> https://bugs.launchpad.net/bugs/524588
> You received this bug notification because you are subscribed to
> OpenObject Server.
>
> Status in OpenObject Server: Incomplete
>
> Bug description:
> When creating database in ukrainian got error in ustr function
> Revering bin/tools/misc.py to revision prior 1977 helps.
>
>
>

--
Thanks & Regards,
Parthiv Patel

Revision history for this message
Ivan Gudym (igudym) wrote :

$ locale
LANG=uk_UA.UTF-8
LC_CTYPE="uk_UA.UTF-8"
LC_NUMERIC="uk_UA.UTF-8"
LC_TIME="uk_UA.UTF-8"
LC_COLLATE="uk_UA.UTF-8"
LC_MONETARY="uk_UA.UTF-8"
LC_MESSAGES="uk_UA.UTF-8"
LC_PAPER="uk_UA.UTF-8"
LC_NAME="uk_UA.UTF-8"
LC_ADDRESS="uk_UA.UTF-8"
LC_TELEPHONE="uk_UA.UTF-8"
LC_MEASUREMENT="uk_UA.UTF-8"
LC_IDENTIFICATION="uk_UA.UTF-8"
LC_ALL=

Revision history for this message
Ivan Gudym (igudym) wrote :

bzr branch lp:openerp
cd openerp
./bzr_set.py

Revision history for this message
Parthiv Patel (parthiv-patel-deactivatedaccount) wrote :

can you please tell us what is the out put of this command :

psql -l

please paste the output of the command.

Regards,
Parthiv

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

To debug this, can you insert the following lines in the function : (Its in bin/tools/misc.py line720)
def ustr(value):

insert a print,

print "Try to make unicode string:", value, type(value)

and paste the stack trace here

Revision history for this message
Ivan Gudym (igudym) wrote :

                                 List of databases
   Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
 exp | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 postgres | postgres | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 qqq | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 template0 | postgres | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
 template1 | postgres | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
 tmp0 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp1 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp2 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp3 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp4 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp5 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp6 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp7 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp8 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |
 tmp9 | openerp | UTF8 | uk_UA.UTF-8 | uk_UA.UTF-8 |

Revision history for this message
Ivan Gudym (igudym) wrote :

Corresponding part of my postgresql.conf

# - Locale and Formatting -

datestyle = 'iso, dmy'
#intervalstyle = 'postgres'
#timezone = unknown<---><------><------># actually, defaults to TZ environment
<------><------><------><------><------># setting
#timezone_abbreviations = 'Default' # Select the set of available time zone
<------><------><------><------><------># abbreviations. Currently, there are
<------><------><------><------><------># Default
<------><------><------><------><------># Australia
<------><------><------><------><------># India
<------><------><------><------><------># You can create your own file in
<------><------><------><------><------># share/timezonesets/.
#extra_float_digits = 0><------><------># min -15, max 2
#client_encoding = sql_ascii<--><------># actually, defaults to database
<------><------><------><------><------># encoding

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'uk_UA.UTF-8'<---><------><------># locale for system error message
<------><------><------><------><------># strings
lc_monetary = 'uk_UA.UTF-8'<---><------><------># locale for monetary formatting
lc_numeric = 'uk_UA.UTF-8'<----><------><------># locale for number formatting
lc_time = 'uk_UA.UTF-8'><------><------><------># locale for time formatting

# default configuration for text search
default_text_search_config = 'pg_catalog.simple'

Revision history for this message
Ivan Gudym (igudym) wrote :

Sorry

# - Locale and Formatting -

datestyle = 'iso, dmy'
#intervalstyle = 'postgres'
#timezone = unknown # actually, defaults to TZ environment
                                        # setting
#timezone_abbreviations = 'Default' # Select the set of available time zone
                                        # abbreviations. Currently, there are
                                        # Default
                                        # Australia
                                        # India
                                        # You can create your own file in
                                        # share/timezonesets/.
#extra_float_digits = 0 # min -15, max 2
#client_encoding = sql_ascii # actually, defaults to database
                                        # encoding

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'uk_UA.UTF-8' # locale for system error message
                                        # strings
lc_monetary = 'uk_UA.UTF-8' # locale for monetary formatting
lc_numeric = 'uk_UA.UTF-8' # locale for number formatting
lc_time = 'uk_UA.UTF-8' # locale for time formatting

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

This is not a database error.

Its trying to translate a value and after the recent refactoring which introduced get_encodings, you are missing an else in line 710

Changed in openobject-server:
status: Incomplete → Confirmed
Revision history for this message
Ivan Gudym (igudym) wrote :

Good.
I set system locale to en_US and got the same error.

Revision history for this message
Stephane Wirtel (OpenERP) (stephane-openerp) wrote :

Sharoon,

Can you provide a fix ?

Thanks

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

@Sharoon:
No, no need to put a else at line 710.

@Ivan:
Can you post us the result of the following command ?
$> python -c "import locale;print locale.getpreferredencoding()"

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

@Christophe,

The concern is it returns a None type and .lower() dows not exist for None type.

Lets wait for Ivan to respond and that should help solve the issue.

We need an else case where the getpreferredencoding() fails to 'guess' the encoding and returns none.

Revision history for this message
Ivan Gudym (igudym) wrote :

$ python -c "import locale;print locale.getpreferredencoding()"
UTF-8

Revision history for this message
Ivan Gudym (igudym) wrote :

@Christophe - What's next?

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

I am keen to know what is that magic term which does not become unicode.

Can you put these two lines in the beggining of your function ustr.
(Insert in line)

print "Try to make unicode string:", value, type(value)

and then paste it here

Looks like the character is �

But keen to know where it came from

Revision history for this message
Ivan Gudym (igudym) wrote :

[2010-02-23 12:06:50,110] INFO:i18n:module base: loading translation file for language uk_UA
Try to make unicode string: <type 'str'> Connection
Try to make unicode string: <type 'str'> create cursor to "aaa"
Try to make unicode string: <type 'str'> ConnectionPool
Try to make unicode string: <type 'str'> ConnectionPool(used=1/count=2/max=64)
Try to make unicode string: <type 'str'> ConnectionPool
Try to make unicode string: <type 'str'> Borrow connection to user=postgres dbname=aaa
Try to make unicode string: <type 'str'> ConnectionPool
Try to make unicode string: <type 'str'> ConnectionPool(used=1/count=2/max=64)
Try to make unicode string: <type 'str'> ConnectionPool
Try to make unicode string: <type 'str'> Create new connection
Try to make unicode string: <type 'str'> uk_UA
Try to make unicode string: <type 'str'> %d.%m.%Y
Try to make unicode string: <type 'str'> uk_UA
Try to make unicode string: <type 'unicode'> Ukrainian / украї́нська мо́ва
Try to make unicode string: <type 'str'> �
exception 1
exception 2 utf8
exception 2 UTF-8
Try to make unicode string: <type 'str'> web-services
Try to make unicode string: <type 'str'> CREATE DATABASE
Traceback (most recent call last):
  File "/home/user/devel/test/openerp/server/bin/service/web_services.py", line 104, in __call__
    modobj.update_translations(cr, 1, mids, lang)
  File "/home/user/devel/test/openerp/server/bin/addons/base/module/module.py", line 484, in update_translations
    tools.trans_load(cr.dbname, f, lang, verbose=False)
  File "/home/user/devel/test/openerp/server/bin/tools/translate.py", line 615, in trans_load
    r = trans_load_data(db_name, fileobj, fileformat, lang, strict=strict, verbose=verbose)
  File "/home/user/devel/test/openerp/server/bin/tools/translate.py", line 665, in trans_load_data
    lang_obj.create(cr, uid, lang_info)
  File "/home/user/devel/test/openerp/server/bin/osv/orm.py", line 2765, in create
    upd2.append(self._columns[field]._symbol_set[1](vals[field]))
  File "/home/user/devel/test/openerp/server/bin/osv/fields.py", line 159, in _symbol_set_char
    u_symb = tools.ustr(symb)
  File "/home/user/devel/test/openerp/server/bin/tools/misc.py", line 751, in ustr
    raise UnicodeError('unable de to convert %r' % (orig,))
UnicodeError: unable de to convert '\xc2\xc2\xa0'

Revision history for this message
Ivan Gudym (igudym) wrote :

def ustr(value):
    """This method is similar to the builtin `str` method, except
    it will return Unicode string.

    @param value: the value to convert

    @rtype: unicode
    @return: unicode string
    """

    print "Try to make unicode string:", type(value), value

    orig = value
    if isinstance(value, Exception):
        return exception_to_unicode(value)

    if isinstance(value, unicode):
        return value

    try:
        return unicode(value)
    except:
        print "exception 1"
        pass

    for ln in get_encodings():
        try:
            return unicode(value, ln)
        except:
            print "exception 2", ln
            pass
    raise UnicodeError('unable de to convert %r' % (orig,))

Revision history for this message
Ivan Gudym (igudym) wrote :

orm.py:

        for field in vals:
            if field in self._columns:
                if self._columns[field]._classic_write:
                    upd0 = upd0 + ',"' + field + '"'
                    upd1 = upd1 + ',' + self._columns[field]._symbol_set[0]
 2765 print vals, field

Revision history for this message
Ivan Gudym (igudym) wrote :

Try to make unicode string: <type 'unicode'> Ukrainian / украї́нська мо́ва
{'date_format': '%d.%m.%Y', 'direction': 'ltr', 'code': 'uk_UA', 'name': u'Ukrainian / \u0443\u043a\u0440\u0430\u0457\u0301\u043d\u0441\u044c\u043a\u0430 \u043c\u043e\u0301\u0432\u0430', 'thousands_sep': '\xc2\xc2\xa0', 'translatable': 1, 'time_format': '%T', 'decimal_point': ',', 'active': 1, 'grouping': '[]'} thousands_sep
Try to make unicode string: <type 'str'> �
exception 1
exception 2 utf8
exception 2 UTF-8

Revision history for this message
Ivan Gudym (igudym) wrote :

Look at: 'thousands_sep': '\xc2\xc2\xa0'

Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

So,
My guess was right :-)

'�' is the problem.

Changed in openobject-server:
status: Confirmed → Triaged
Revision history for this message
Ivan Gudym (igudym) wrote :

Here interere two bugs.
1. First - bug in ustr, which was introduced in 1977 revision of misc.py
2. Second - bug in translate.py, which set thousand separator to strange symbol while it should be plane space " "

I can't understand this magic of translate.py:

                'decimal_point' : str(locale.localeconv()['decimal_point']).replace('\xa0', '\xc2\xa0'),
                'thousands_sep' : str(locale.localeconv()['thousands_sep']).replace('\xa0', '\xc2\xa0'),
What is '\xc2\xa0'?

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

In fact the bug is in translate.py at lines 660 and 661

Changed in openobject-server:
assignee: nobody → Christophe (OpenERP) (kangol)
Revision history for this message
Ivan Gudym (igudym) wrote :
Revision history for this message
Ivan Gudym (igudym) wrote :

This strange "replace" was moved by Stephane Wirtel from fields.py to translate.py in revision 1705.
There it was first introduced by himself in revision 1703.

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

Fixed by <email address hidden>

Changed in openobject-server:
status: Triaged → Fix Released
milestone: none → 5.0.7
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.