[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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user