From 9e253bbe63dd7ef5e40972bc73bc6bf2bc77a913 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 15 Sep 2023 08:36:20 +0200 Subject: [PATCH] [IMP] module: deprecate get_resource_path file_path is superior and can replace every (often unnecessary) calls Merge check_resource_path that is no longer needed Part-of: odoo/odoo#135607 --- odoo/modules/module.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/odoo/modules/module.py b/odoo/modules/module.py index 67297f0c154..79d6a9f3511 100644 --- a/odoo/modules/module.py +++ b/odoo/modules/module.py @@ -196,21 +196,19 @@ def get_resource_path(module, *args): :rtype: str :return: absolute path to the resource """ + warnings.warn( + f"Since 17.0: use tools.misc.file_path instead of get_resource_path({module}, {args})", + DeprecationWarning, + ) resource_path = opj(module, *args) try: return file_path(resource_path) except (FileNotFoundError, ValueError): return False -def check_resource_path(mod_path, *args): - resource_path = opj(mod_path, *args) - try: - return file_path(resource_path) - except (FileNotFoundError, ValueError): - return False - # backwards compatibility get_module_resource = get_resource_path +check_resource_path = get_resource_path def get_resource_from_path(path): """Tries to extract the module name and the resource's relative path