Merge lp:~savoirfairelinux-openerp/openobject-server/translate_warnings_1297525-trunk into lp:openobject-server

Status: Needs review
Proposed branch: lp:~savoirfairelinux-openerp/openobject-server/translate_warnings_1297525-trunk
Merge into: lp:openobject-server
Diff against target: 25 lines (+2/-2)
2 files modified
openerp/osv/orm.py (+1/-1)
openerp/tools/translate.py (+1/-1)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/openobject-server/translate_warnings_1297525-trunk
Reviewer Review Type Date Requested Status
OpenERP Core Team 2014-03-25 Pending
Review via email: mp+212738@code.launchpad.net

Description of the change

When searching a frame for context, the _() call looks for self.localcontext but misses self.context.
The integration of this patch allows for web warnings (such as except_orm) to be translated by _()

To post a comment you must log in.
5151. By El Hadji Dem (http://www.savoirfairelinux.com) on 2014-04-06

[FIX] Fixed instance of ValidateError not being translated

Unmerged revisions

5151. By El Hadji Dem (http://www.savoirfairelinux.com) on 2014-04-06

[FIX] Fixed instance of ValidateError not being translated

5150. By Sandy Carter (http://www.savoirfairelinux.com) on 2014-03-25

Also look for context in self

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 2014-04-01 10:08:19 +0000
3+++ openerp/osv/orm.py 2014-04-06 00:17:16 +0000
4@@ -1576,7 +1576,7 @@
5 )
6 self._invalids.update(fields)
7 if error_msgs:
8- raise except_orm('ValidateError', '\n'.join(error_msgs))
9+ raise except_orm(_('ValidateError'), '\n'.join(error_msgs))
10 else:
11 self._invalids.clear()
12
13
14=== modified file 'openerp/tools/translate.py'
15--- openerp/tools/translate.py 2014-03-20 09:01:05 +0000
16+++ openerp/tools/translate.py 2014-04-06 00:17:16 +0000
17@@ -196,7 +196,7 @@
18 lang = ctx.get('lang')
19 s = frame.f_locals.get('self', {})
20 if not lang:
21- c = getattr(s, 'localcontext', None)
22+ c = getattr(s, 'localcontext', None) or getattr(s, 'context', None)
23 if c:
24 lang = c.get('lang')
25 if not lang: