Merge lp:~openerp-dev/openobject-server/6.0-opw-17601-rgo into lp:openobject-server/6.0

Proposed by Ravi Gohil (OpenERP)
Status: Merged
Merged at revision: 3510
Proposed branch: lp:~openerp-dev/openobject-server/6.0-opw-17601-rgo
Merge into: lp:openobject-server/6.0
Diff against target: 11 lines (+1/-1)
1 file modified
bin/addons/base/ir/ir_model.py (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.0-opw-17601-rgo
Reviewer Review Type Date Requested Status
Raphael Collet (OpenERP) (community) Approve
Olivier Dony (Odoo) Approve
Anup(SerpentCS) (community) Approve
Ravi Gohil (OpenERP) (community) Needs Resubmitting
Review via email: mp+77453@code.launchpad.net

This proposal supersedes a proposal from 2011-09-21.

Description of the change

Hello,

I have done the suggested changes.

Thanks

To post a comment you must log in.
Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote : Posted in a previous version of this proposal

Hello Ravi,

I agree with you. I would definitely admit that any method which is being called by xmlrpc should not return None as 'None' is not being marshaled and raises an error.

I agree with your fix but I think won't be feasible to do it on a single method or it would require lot's of changes with other methods which are returning None.

So IMHO there should be some generic way to get rid of the issue. Whenever xmlrpc calls a method.

We still need to discuss with experts before merging it.

@Raphael,Olivier Can you please share your views?

Thanks.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote : Posted in a previous version of this proposal

ir.model.access.check() is not meant to be called in RPC, but it's better to fix it indeed, as it is technically RPC-exposed.

For the fix, wouldn't it be better to put `or False` on the return line instead, to catch future changes/mistakes.

As for a global solution, as you know XML-RPC support for `null` is not properly standardized so we shouldn't waste too much time with this. Introspecting returned data structure to catch None values seems like overkill. It's not very important, we'll gradually move over to JSON-RPC instead, which supports `null`, and in the mean time, developers should just be aware of it and be careful.

review: Needs Fixing
Revision history for this message
Ravi Gohil (OpenERP) (rgo-openerp) :
review: Needs Resubmitting
Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello,

Olivier, I do agree with you that this definitely is a better way.

Thanks.

review: Approve
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Looks good to me now

review: Approve
Revision history for this message
Raphael Collet (OpenERP) (rco-openerp) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/base/ir/ir_model.py'
2--- bin/addons/base/ir/ir_model.py 2011-04-06 15:05:25 +0000
3+++ bin/addons/base/ir/ir_model.py 2011-09-29 06:09:26 +0000
4@@ -512,7 +512,7 @@
5 }
6
7 raise except_orm(_('AccessError'), msgs[mode] % (model_name, groups) )
8- return r
9+ return r or False
10
11 check = tools.cache()(check)
12