# HG changeset patch # User Katia Saurfelt # Date 1328867117 -3600 # Node ID 1d1cfc97f6b92e55b389a113910ad0be8f98df29 # Parent 517fbaad0e6e1c81ed5b4cc9897a3e2dbaa3d121 [migration] fire hooks in postcreate by default (closes #1417110) also turn usage of hooks_control to relevent session's method diff -r 517fbaad0e6e -r 1d1cfc97f6b9 server/migractions.py --- a/server/migractions.py Thu Feb 09 13:22:49 2012 +0100 +++ b/server/migractions.py Fri Feb 10 10:45:17 2012 +0100 @@ -58,7 +58,6 @@ from cubicweb.cwvreg import CW_EVENT_MANAGER from cubicweb.dbapi import get_repository, repo_connect from cubicweb.migration import MigrationHelper, yes -from cubicweb.server.session import hooks_control from cubicweb.server import hook try: from cubicweb.server import SOURCE_TYPES, schemaserial as ss @@ -152,7 +151,7 @@ elif options.backup_db: self.backup_database(askconfirm=False) # disable notification during migration - with hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'notification'): + with self.session.allow_all_hooks_but('notification'): super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options) def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs): @@ -376,6 +375,9 @@ self.confirm = yes self.execscript_confirm = yes try: + if event == 'postcreate': + with self.session.allow_all_hooks_but(): + return self.cmd_process_script(apc, funcname, *args, **kwargs) return self.cmd_process_script(apc, funcname, *args, **kwargs) finally: self.confirm = confirm @@ -698,8 +700,9 @@ str(totype)) # execute post-create files for cube in reversed(newcubes): - self.cmd_exec_event_script('postcreate', cube) - self.commit() + with self.session.allow_all_hooks_but(): + self.cmd_exec_event_script('postcreate', cube) + self.commit() def cmd_remove_cube(self, cube, removedeps=False): removedcubes = super(ServerMigrationHelper, self).cmd_remove_cube(