[FIX] Import the module in a zip archive

lp bug: https://launchpad.net/bugs/297092 fixed
lp bug: https://launchpad.net/bugs/298723 fixed

bzr revid: stephane@tinyerp.com-20081118103511-8zdsbevbaxijf1dk
This commit is contained in:
Stephane Wirtel 2008-11-18 11:35:11 +01:00
parent 7089927d84
commit 5c2082d4d4
1 changed files with 5 additions and 3 deletions

View File

@ -428,13 +428,15 @@ class module(osv.osv):
terp = self.get_module_info(mod_name)
if not terp or not terp.get('installable', True):
continue
if not os.path.isfile(mod_path+'.zip'):
if not os.path.isfile( mod_path ):
import imp
# XXX must restrict to only addons paths
imp.load_module(name, *imp.find_module(mod_name))
path = imp.find_module(mod_name)
imp.load_module(name, *path)
else:
import zipimport
zimp = zipimport.zipimporter(mod_path+'.zip')
zimp = zipimport.zipimporter(mod_path)
zimp.load_module(mod_name)
id = self.create(cr, uid, {
'name': mod_name,