From 3d6b88c87e888fd1219c75a0ead7397f1bf7bcd0 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 11 Oct 2010 12:27:03 +0530 Subject: [PATCH] [FIX] fixed regression on get_module_resource method to clean checking of file bzr revid: hmo@tinyerp.com-20101011065703-96zngxucees6zwx1 --- bin/addons/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 7db007b732f..8e75a7d1124 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -270,16 +270,17 @@ def get_module_resource(module, *args): @return: absolute path to the resource """ a = get_module_path(module) + res = a and opj(a, *args) or False if zipfile.is_zipfile( a +'.zip') : zip = zipfile.ZipFile( a + ".zip") - files = ['/'.join(f.split('/')[1:]) for f in zip.namelist()] + files = [opj(a,'/'.join(f.split('/')[1:])) for f in zip.namelist()] + if res in files: + return res else: - files = tools.osutil.listdir(a, True) - for ar in args: - if ar not in files: - return False - res = a and opj(a, *args) or False - return res + if os.path.isfile(res): + return res + + return False