Add import of zip module that have been downloaded

This commit is contained in:
Cédric Krier
2008-01-19 00:14:51 +01:00
parent ab70e58b85
commit 2f447aeaf9
+5
View File
@@ -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):