Merge lp:~openerp-dev/openobject-server/trunk-bug-797690-nco into lp:openobject-server

Proposed by Nimesh Contractor(Open ERP)
Status: Rejected
Rejected by: Vo Minh Thu
Proposed branch: lp:~openerp-dev/openobject-server/trunk-bug-797690-nco
Merge into: lp:openobject-server
Diff against target: 29 lines (+6/-1)
1 file modified
openerp/osv/orm.py (+6/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/trunk-bug-797690-nco
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Disapprove
Vo Minh Thu Pending
Review via email: mp+65291@code.launchpad.net

Description of the change

hello sir,

Solve the problem of _sql_constraints is not supported in other languages.

Thank You.

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello Nimesh,

The problem is supposed to arise from a commit at <email address hidden>
which introduced the use of "cgitb" module for formatting the traceback but this modules "text" method is unable to handle the Unicode encoding.

@ vmt: can you please have a look at it. There is a regression due to revision:3452 [ADD] openerp/netsvc: use cgitb to format the exception sent to the client, code/idea by chs.
revision-info:<email address hidden>

Thanks,

review: Disapprove
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :
Revision history for this message
Vo Minh Thu (thu) wrote :

The fix is simply to remove cgitb (or make sure it doesn't call str).

Unmerged revisions

3471. By Nimesh Contractor(Open ERP)

[fix] _sql_constraints not supported in other language

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/osv/orm.py'
2--- openerp/osv/orm.py 2011-06-19 11:57:01 +0000
3+++ openerp/osv/orm.py 2011-06-21 05:12:51 +0000
4@@ -1116,6 +1116,7 @@
5 lng = context.get('lang', False) or 'en_US'
6 trans = self.pool.get('ir.translation')
7 error_msgs = []
8+ import unicodedata
9 for constraint in self._constraints:
10 fun, msg, fields = constraint
11 if not fun(self, cr, uid, ids):
12@@ -1130,13 +1131,17 @@
13 translated_msg = tmp_msg
14 else:
15 translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg
16+
17+ translated_msg = unicodedata.normalize('NFKD', translated_msg).encode('ascii','ignore')
18 error_msgs.append(
19 _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
20 )
21 self._invalids.update(fields)
22 if error_msgs:
23 cr.rollback()
24- raise except_orm('ValidateError', '\n'.join(error_msgs))
25+ for i in error_msgs:
26+ translated_msg = unicodedata.normalize('NFKD', i).encode('ascii','ignore') + '\n'
27+ raise except_orm('ValidateError', translated_msg)
28 else:
29 self._invalids.clear()
30