← Back to team overview

credativ team mailing list archive

lp:~therp-nl/openupgrade-server/openupgrade-server_catch_less_exceptions into lp:openupgrade-server

 

Holger Brunn (Therp) has proposed merging lp:~therp-nl/openupgrade-server/openupgrade-server_catch_less_exceptions into lp:openupgrade-server.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/openupgrade-server_catch_less_exceptions/+merge/130969
-- 
https://code.launchpad.net/~therp-nl/openupgrade-server/openupgrade-server_catch_less_exceptions/+merge/130969
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/openupgrade-server_catch_less_exceptions into lp:openupgrade-server.
=== modified file 'openerp/modules/migration.py'
--- openerp/modules/migration.py	2012-01-24 12:42:52 +0000
+++ openerp/modules/migration.py	2012-10-23 09:58:23 +0000
@@ -182,15 +182,16 @@
                         fp2.seek(0)
                         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)
                         except ImportError:
                             _logger.error('module %(addon)s: Unable to load %(stage)s-migration file %(file)s' % mergedict({'file': pyfile}, strfmt))
                             raise
-                        except AttributeError:
+
+                        _logger.info('module %(addon)s: Running migration %(version)s %(name)s' % mergedict({'name': mod.__name__}, strfmt))
+
+                        if hasattr(mod, 'migrate'):
+                            mod.migrate(self.cr, pkg.installed_version)
+                        else:
                             _logger.error('module %(addon)s: Each %(stage)s-migration file must have a "migrate(cr, installed_version)" function' % strfmt)
-                        except:
-                            raise
                     finally:
                         if fp:
                             fp.close()


Follow ups