summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2010-10-11 13:25:36 +0200
committerOlivier Dony <odo@openerp.com>2010-10-11 13:25:36 +0200
commit595a07e49ecbbef0cf00a506d176f5868997249a (patch)
tree915a0bff36aafa8901da3fdd19d64c1b6e9e5d8d
parent9df06539a4e6b4f280ed1cd3096ac7e8c1302f08 (diff)
parentf9eb2e0260ba98475860e4daef7d12814fd40b5e (diff)
[MERGE:FIX] addons: ZIP module import repaired
bzr revid: odo@openerp.com-20101011112536-34d6cueqjkk32u8c
-rw-r--r--bin/addons/__init__.py18
-rw-r--r--bin/addons/base/module/module.py2
2 files changed, 15 insertions, 5 deletions
diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py
index 08cc60c19bd..72e9fb2c6e2 100644
--- a/bin/addons/__init__.py
+++ b/bin/addons/__init__.py
@@ -270,7 +270,17 @@ def get_module_resource(module, *args):
@return: absolute path to the resource
"""
a = get_module_path(module)
- return a and opj(a, *args) or False
+ 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()]
+ res = '/'.join(args)
+ if res in files:
+ return opj(a, res)
+ elif os.path.isfile(res):
+ return res
+ return False
+
def get_modules():
@@ -297,9 +307,10 @@ def load_information_from_description_file(module):
"""
:param module: The name of the module (sale, purchase, ...)
"""
+
for filename in ['__openerp__.py', '__terp__.py']:
description_file = get_module_resource(module, filename)
- if os.path.isfile(description_file):
+ if description_file :
return eval(tools.file_open(description_file).read())
#TODO: refactor the logger in this file to follow the logging guidelines
@@ -332,9 +343,8 @@ def upgrade_graph(graph, cr, module_list, force=None):
for module in module_list:
mod_path = get_module_path(module)
terp_file = get_module_resource(module, '__openerp__.py')
- if not terp_file or not os.path.isfile(terp_file):
+ if not terp_file:
terp_file = get_module_resource(module, '__terp__.py')
-
if not mod_path or not terp_file:
logger.notifyChannel('init', netsvc.LOG_WARNING, 'module %s: not found, skipped' % (module))
continue
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py
index b446f39f5b5..74cd018399c 100644
--- a/bin/addons/base/module/module.py
+++ b/bin/addons/base/module/module.py
@@ -247,7 +247,7 @@ class module(osv.osv):
else:
od = self.browse(cr, uid, ids2)[0]
mdemo = od.demo or mdemo
-
+
terp = self.get_module_info(module.name)
try:
self._check_external_dependencies(terp)