[FIX] base: modules: install_from_urls: an empty url mean nothing to download

bzr revid: chs@openerp.com-20121002132535-l0tajxiqydn7ahcv
This commit is contained in:
Christophe Simonis 2012-10-02 15:25:35 +02:00
parent bbf705dbcf
commit 5eccc93177
1 changed files with 5 additions and 4 deletions

View File

@ -617,11 +617,14 @@ class module(osv.osv):
return res
def install_from_urls(self, cr, uid, urls, context=None):
OPENERP = 'openerp'
tmp = tempfile.mkdtemp()
try:
for module_name in urls:
for module_name, url in urls.items():
if not url:
continue # nothing to download, local version is already the last one
try:
content = urllib2.urlopen(urls[module_name]).read()
content = urllib2.urlopen(url).read()
except Exception, e:
_logger.exception('ggr')
raise osv.except_osv('grrr', e)
@ -629,8 +632,6 @@ class module(osv.osv):
zipfile.ZipFile(StringIO(content)).extractall(tmp)
assert os.path.isdir(os.path.join(tmp, module_name))
OPENERP = 'openerp'
for module_name in urls:
if module_name == OPENERP:
continue # special case. handled below