From 9518e6c323c2458d416a4455ae3cb9e834e92121 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 27 Jan 2014 16:17:26 +0100 Subject: [PATCH] [IMP] in ir_model_data.get_object(), rename parameter 'check' into 'raise_exception' bzr revid: rco@openerp.com-20140127151726-if92mwiu3xawr8ge --- openerp/addons/base/ir/ir_model.py | 14 +++++++------- openerp/addons/base/res/res_users.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 4e4e6bde4c0..d5033518164 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -884,24 +884,24 @@ class ir_model_data(osv.osv): raise ValueError('Not enough access rights on the external ID: %s.%s' % (module, xml_id)) return model, False - def get_object(self, cr, uid, module, xml_id, context=None, check=True): + def get_object(self, cr, uid, module, xml_id, context=None, raise_exception=True): """ Returns a browsable record for the given module name and xml_id. If not found, raise a ValueError or return a browse_null, depending - on the value of `check`. + on the value of `raise_exception`. - :param check: when true, check whether record exists and raise a - ValueError if it does not; otherwise return a browse_null or - non-existing record. + :param raise_exception: when true, check whether record exists and + raise a ValueError if it does not; otherwise return a browse_null + or non-existing record. """ try: res_model, res_id = self.get_object_reference(cr, uid, module, xml_id) record = self.pool[res_model].browse(cr, uid, res_id, context=context) except ValueError: - if check: + if raise_exception: raise return browse_null() - if check and not record.exists(): + if raise_exception and not record.exists(): raise ValueError('No record found for unique ID %s.%s. It may have been deleted.' % (module, xml_id)) return record diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index db75028742c..9201b11114f 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -685,7 +685,7 @@ class groups_view(osv.osv): # and introduces the reified group fields # we have to try-catch this, because at first init the view does not exist # but we are already creating some basic groups - view = self.pool['ir.model.data'].get_object(cr, SUPERUSER_ID, 'base', 'user_groups_view', context=context, check=False) + view = self.pool['ir.model.data'].get_object(cr, SUPERUSER_ID, 'base', 'user_groups_view', context=context, raise_exception=False) if view and view.exists() and view._table_name == 'ir.ui.view': xml1, xml2 = [], [] xml1.append(E.separator(string=_('Application'), colspan="4"))