[FIX] fixed regression on get_module_resource method to clean checking of file

bzr revid: hmo@tinyerp.com-20101011065703-96zngxucees6zwx1
This commit is contained in:
Harry (OpenERP)
2010-10-11 12:27:03 +05:30
parent 6422e85919
commit 3d6b88c87e
+8 -7
View File
@@ -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