From 4897f1740eb0e15cf35a54a03860e1e2886fe50d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 8 May 2013 12:46:58 +0200 Subject: [PATCH] [FIX] openerp.modules.migration: do not shadow AttributeError that may occure when executing the migrate() function bzr revid: chs@openerp.com-20130508104658-d2553vdx0etiuhpk --- openerp/modules/migration.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openerp/modules/migration.py b/openerp/modules/migration.py index 3dbc725109b..4ded70ffcb2 100644 --- a/openerp/modules/migration.py +++ b/openerp/modules/migration.py @@ -3,7 +3,7 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). -# Copyright (C) 2010-2011 OpenERP s.a. (). +# Copyright (C) 2010-2013 OpenERP s.a. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -180,14 +180,14 @@ class MigrationManager(object): try: mod = imp.load_source(name, pyfile, fp2) _logger.info('module %(addon)s: Running migration %(version)s %(name)s' % mergedict({'name': mod.__name__}, strfmt)) - mod.migrate(self.cr, pkg.installed_version) + migrate = mod.migrate except ImportError: - _logger.error('module %(addon)s: Unable to load %(stage)s-migration file %(file)s' % mergedict({'file': pyfile}, strfmt)) + _logger.exception('module %(addon)s: Unable to load %(stage)s-migration file %(file)s' % mergedict({'file': pyfile}, strfmt)) raise except AttributeError: _logger.error('module %(addon)s: Each %(stage)s-migration file must have a "migrate(cr, installed_version)" function' % strfmt) - except: - raise + else: + migrate(self.cr, pkg.installed_version) finally: if fp: fp.close()