c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #20056
[Bug 741765] [NEW] [trunk] selection widget and unicode
Public bug reported:
I want create selection with unicode data in fields.
'selection': fields.selection(
[(u'тест', u'тест')],
string="Test selection"),
But I receive error:
###
/home/kodemi/src/openerp6/web/addons/openerp/widgets/form/_form.py in set_value(self=Selection, value='')
535
536 for s in dict(self.options):
537 if str(s) == str(value):
538 """
539 print "s: %s %s" % (s, type(s))
builtin str = <type 'str'>, s = u'\u0442\u0435\u0441\u0442', value = ''
<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
args = ('ascii', u'\u0442\u0435\u0441\u0442', 0, 4, 'ordinal not in range(128)')
encoding = 'ascii'
end = 4
message = ''
object = u'\u0442\u0435\u0441\u0442'
reason = 'ordinal not in range(128)'
start = 0
###
I changed in _form.py in set_value:
from: if str(s) == str(value)
to: if unicode(s) == unicode(value)
Now it works.
** Affects: openobject-client-web
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/741765
Title:
[trunk] selection widget and unicode
Status in OpenERP Web Client:
New
Bug description:
I want create selection with unicode data in fields.
'selection': fields.selection(
[(u'тест', u'тест')],
string="Test selection"),
But I receive error:
###
/home/kodemi/src/openerp6/web/addons/openerp/widgets/form/_form.py in set_value(self=Selection, value='')
535
536 for s in dict(self.options):
537 if str(s) == str(value):
538 """
539 print "s: %s %s" % (s, type(s))
builtin str = <type 'str'>, s = u'\u0442\u0435\u0441\u0442', value = ''
<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
args = ('ascii', u'\u0442\u0435\u0441\u0442', 0, 4, 'ordinal not in range(128)')
encoding = 'ascii'
end = 4
message = ''
object = u'\u0442\u0435\u0441\u0442'
reason = 'ordinal not in range(128)'
start = 0
###
I changed in _form.py in set_value:
from: if str(s) == str(value)
to: if unicode(s) == unicode(value)
Now it works.
Follow ups
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Xavier (Open ERP), 2011-03-30
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Launchpad Bug Tracker, 2011-03-30
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Kunal Chavda (OpenERP), 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Launchpad Bug Tracker, 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Kunal Chavda (OpenERP), 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Kinner Vachhani http://techreceptives.com, 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Denis Konchekov, 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Kinner Vachhani http://techreceptives.com, 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Devishree Brahmbhatt (OpenERP), 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Devishree Brahmbhatt (OpenERP), 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Devishree Brahmbhatt (OpenERP), 2011-03-29
-
[Bug 741765] Re: [trunk] selection widget and unicode
From: Denis Konchekov, 2011-03-24
-
[Bug 741765] [NEW] [trunk] selection widget and unicode
From: Denis Konchekov, 2011-03-24
References