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

Proposed by Ravi Gohil (OpenERP)
Status: Superseded
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
Olivier Dony (Odoo) Needs Fixing
Raphael Collet (OpenERP) Pending
Anup(SerpentCS) Pending
Review via email: mp+76341@code.launchpad.net

This proposal has been superseded by a proposal from 2011-09-29.

Description of the change

Hello,

When calling ir.model.access 'check' method, with raise_exception=False, and
when there is no access right (no specific and no generic one) defined in the
system, the server return None (which is not valid for XMLRPC).

This fixes the issue.

Thanks.

To post a comment you must log in.
3494. By Raphael Collet (OpenERP)

[MERGE] improve method exists() to handle list of ids

3495. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

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 :

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
3496. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3497. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3498. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3499. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

3500. By Ravi Gohil (OpenERP)

[FIX] base: change the code by returning 'or False' on return

Unmerged revisions

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:00:20 +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