[IMP] report: registration deprecation now guarded via openerp.conf.deprecation.

bzr revid: vmt@openerp.com-20130325131756-5bns19n20nar9ogs
This commit is contained in:
Vo Minh Thu 2013-03-25 14:17:56 +01:00
parent 464af881bf
commit 1ea66164f3
2 changed files with 9 additions and 2 deletions

View File

@ -43,8 +43,13 @@ open_openerp_namespace = False
# Among the related code:
# - The openerp.netsvc.LocalService() function.
# - The openerp.report.interface.report_int._reports dictionary.
# - The register attribute in openerp.report.report_sxw (and in its inheriting
# classes).
# - The register attribute in openerp.report.interface.report_int (and in its
# inheriting classes).
allow_local_service = True
# Applies for the register attribute in openerp.report.interface.report_int.
# See comments for allow_local_service above.
# Introduced around 2013.03.
allow_report_int_registration = True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -45,6 +45,8 @@ class report_int(object):
def __init__(self, name, register=True):
if register:
import openerp
assert openerp.conf.deprecation.allow_report_int_registration
assert name.startswith('report.'), 'Report names should start with "report.".'
assert name not in self._reports, 'The report "%s" already exists.' % name
self._reports[name] = self