Skip to content

Commit

Permalink
[FIX] import-hook: correctly import the server-wide-module (i.e
Browse files Browse the repository at this point in the history
use the openerp.addons namespace), and correctly set the submodules in
sys.modules (instead of only the top-level package).

bzr revid: [email protected]
  • Loading branch information
Vo Minh Thu committed Feb 1, 2012
1 parent 996578e commit 084af04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openerp-server
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ if __name__ == "__main__":

for m in openerp.conf.server_wide_modules:
try:
__import__(m)
__import__('openerp.addons.' + m)
# Call any post_load hook.
info = openerp.modules.module.load_information_from_description_file(m)
if info['post_load']:
Expand Down
3 changes: 3 additions & 0 deletions openerp/modules/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ def load_module(self, module_name):
mod = imp.load_module(module_name, f, path, descr)
if not is_shadowing:
sys.modules[module_part] = mod
for k in sys.modules.keys():
if k.startswith('openerp.addons.' + module_part):
sys.modules[k[len('openerp.addons.'):]] = sys.modules[k]
sys.modules['openerp.addons.' + module_part] = mod
return mod

Expand Down

0 comments on commit 084af04

Please sign in to comment.