[FIX] close the opened file when loading a module
bzr revid: christophe@cobalt-20090102224412-ye7am97hdx8ib2yi
This commit is contained in:
parent
8a6401cfa6
commit
aea0ab1d89
|
@ -326,7 +326,12 @@ def register_class(m):
|
|||
try:
|
||||
zip_mod_path = mod_path + '.zip'
|
||||
if not os.path.isfile(zip_mod_path):
|
||||
imp.load_module(m, *imp.find_module(m, [ad, _ad]))
|
||||
fm = imp.find_module(m, [ad, _ad])
|
||||
try:
|
||||
imp.load_module(m, *fm)
|
||||
finally:
|
||||
if fm[0]:
|
||||
fm[0].close()
|
||||
else:
|
||||
zimp = zipimport.zipimporter(zip_mod_path)
|
||||
zimp.load_module(m)
|
||||
|
|
|
@ -57,7 +57,15 @@ class wizard_install_module(wizard.interface):
|
|||
terp = mod_obj.get_module_info(module)
|
||||
if not terp.get('installable', True):
|
||||
continue
|
||||
imp.load_module(module, *imp.find_module(module))
|
||||
|
||||
# XXX check if this code is correct...
|
||||
fm = imp.find_module(module)
|
||||
try:
|
||||
imp.load_module(module, *fm)
|
||||
finally:
|
||||
if fm[0]:
|
||||
fm[0].close()
|
||||
|
||||
mod_id = mod_obj.create(cr, uid, {
|
||||
'name': module,
|
||||
'state': 'uninstalled',
|
||||
|
|
Loading…
Reference in New Issue