From 2f447aeaf928208fa19d319b4086bce60ca5fb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 19 Jan 2008 00:14:51 +0100 Subject: [PATCH] Add import of zip module that have been downloaded --- trytond/ir/module/module.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trytond/ir/module/module.py b/trytond/ir/module/module.py index 2493ce998b..84e548e6d1 100644 --- a/trytond/ir/module/module.py +++ b/trytond/ir/module/module.py @@ -3,6 +3,7 @@ import os import re import zipfile import urllib +import zipimport from trytond.osv import fields, OSV import trytond.tools as tools from trytond.module import ADDONS_PATH @@ -426,6 +427,7 @@ class Module(OSV): return res def download(self, cursor, user, ids, download=True, context=None): + # TODO download import only if all dependencies are present res = [] for mod in self.browse(cursor, user, ids, context=context): if not mod.url: @@ -460,6 +462,9 @@ class Module(OSV): [])) self._update_category(cursor, user, mod.id, tryton.get('category', 'Uncategorized')) + # Import module + zimp = zipimport.zipimporter(fname) + zimp.load_module(mod.name) return res def _update_dependencies(self, cursor, user, module_id, depends=None):