From 31e9abb2a67c1806658d077c464ee32332a97d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 1 Jun 2009 20:38:44 +0200 Subject: [PATCH] Remove MODULES_PATH from PATH to prevent module name collision Append trytond.modules to module import --- trytond/modules/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/trytond/modules/__init__.py b/trytond/modules/__init__.py index 1dadf16bda..1ed96223d3 100644 --- a/trytond/modules/__init__.py +++ b/trytond/modules/__init__.py @@ -12,7 +12,6 @@ import logging OPJ = os.path.join MODULES_PATH = os.path.dirname(__file__) -sys.path.insert(1, MODULES_PATH) MODULES = [] @@ -332,12 +331,13 @@ def register_classes(): if os.path.isfile(OPJ(MODULES_PATH, module + '.zip')): mod_path = OPJ(MODULES_PATH, module + '.zip') zimp = zipimport.zipimporter(mod_path) - zimp.load_module(module) + zimp.load_module('trytond.modules.' + module) elif os.path.isdir(OPJ(MODULES_PATH, module)): mod_file, pathname, description = imp.find_module(module, [MODULES_PATH]) try: - imp.load_module(module, mod_file, pathname, description) + imp.load_module('trytond.modules.' + module, mod_file, + pathname, description) finally: if mod_file is not None: mod_file.close() @@ -348,7 +348,8 @@ def register_classes(): mod_file, pathname, description = imp.find_module(module, [mod_path]) try: - imp.load_module(module, mod_file, pathname, description) + imp.load_module('trytond.modules.' + module, mod_file, + pathname, description) finally: if mod_file is not None: mod_file.close()