[FIX] addons: fixed cross-platform compatibility for get_module_resource()

bzr revid: odo@openerp.com-20101011102439-qgrsxquxdmasnty8
This commit is contained in:
Olivier Dony 2010-10-11 12:24:39 +02:00
parent 3d6b88c87e
commit f9eb2e0260
1 changed files with 5 additions and 6 deletions

View File

@ -273,13 +273,12 @@ def get_module_resource(module, *args):
res = a and opj(a, *args) or False
if zipfile.is_zipfile( a +'.zip') :
zip = zipfile.ZipFile( a + ".zip")
files = [opj(a,'/'.join(f.split('/')[1:])) for f in zip.namelist()]
files = ['/'.join(f.split('/')[1:]) for f in zip.namelist()]
res = '/'.join(args)
if res in files:
return res
else:
if os.path.isfile(res):
return res
return opj(a, res)
elif os.path.isfile(res):
return res
return False