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
=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py 2011-06-19 11:57:01 +0000
+++ openerp/osv/orm.py 2011-06-21 05:12:51 +0000
@@ -1116,6 +1116,7 @@
1116 lng = context.get('lang', False) or 'en_US'1116 lng = context.get('lang', False) or 'en_US'
1117 trans = self.pool.get('ir.translation')1117 trans = self.pool.get('ir.translation')
1118 error_msgs = []1118 error_msgs = []
1119 import unicodedata
1119 for constraint in self._constraints:1120 for constraint in self._constraints:
1120 fun, msg, fields = constraint1121 fun, msg, fields = constraint
1121 if not fun(self, cr, uid, ids):1122 if not fun(self, cr, uid, ids):
@@ -1130,13 +1131,17 @@
1130 translated_msg = tmp_msg1131 translated_msg = tmp_msg
1131 else:1132 else:
1132 translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg1133 translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg
1134
1135 translated_msg = unicodedata.normalize('NFKD', translated_msg).encode('ascii','ignore')
1133 error_msgs.append(1136 error_msgs.append(
1134 _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)1137 _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
1135 )1138 )
1136 self._invalids.update(fields)1139 self._invalids.update(fields)
1137 if error_msgs:1140 if error_msgs:
1138 cr.rollback()1141 cr.rollback()
1139 raise except_orm('ValidateError', '\n'.join(error_msgs))1142 for i in error_msgs:
1143 translated_msg = unicodedata.normalize('NFKD', i).encode('ascii','ignore') + '\n'
1144 raise except_orm('ValidateError', translated_msg)
1140 else:1145 else:
1141 self._invalids.clear()1146 self._invalids.clear()
11421147