# HG changeset patch # User Sylvain Thénault # Date 1268814197 -3600 # Node ID 84684417beb9e83525ff2b7d9b874b411b5c0014 # Parent 449f6c144ad4f4d32974be251de725c695c84ab8# Parent 0d66fbe050c694345887b9feff034b99313a9b22 merge diff -r 449f6c144ad4 -r 84684417beb9 server/migractions.py --- a/server/migractions.py Wed Mar 17 09:23:05 2010 +0100 +++ b/server/migractions.py Wed Mar 17 09:23:17 2010 +0100 @@ -15,6 +15,8 @@ :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses """ +from __future__ import with_statement + __docformat__ = "restructuredtext en" import sys @@ -40,7 +42,7 @@ CubicWebRelationSchema, order_eschemas) from cubicweb.dbapi import get_repository, repo_connect from cubicweb.migration import MigrationHelper, yes - +from cubicweb.server.session import hooks_control try: from cubicweb.server import SOURCE_TYPES, schemaserial as ss from cubicweb.server.utils import manager_userpasswd, ask_source_config @@ -96,7 +98,9 @@ self.backup_database() elif options.backup_db: self.backup_database(askconfirm=False) - super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options) + # disable notification during migration + with hooks_control(self.session, self.session.HOOKS_ALLOW_ALL, 'notification'): + super(ServerMigrationHelper, self).migrate(vcconf, toupgrade, options) def cmd_process_script(self, migrscript, funcname=None, *args, **kwargs): """execute a migration script diff -r 449f6c144ad4 -r 84684417beb9 server/session.py --- a/server/session.py Wed Mar 17 09:23:05 2010 +0100 +++ b/server/session.py Wed Mar 17 09:23:17 2010 +0100 @@ -153,7 +153,12 @@ def hijack_user(self, user): """return a fake request/session using specified user""" session = Session(user, self.repo) - session._threaddata.pool = self.pool + threaddata = session._threaddata + threaddata.pool = self.pool + # everything in transaction_data should be copied back but the entity + # type cache we don't want to avoid security pb + threaddata.transaction_data = self.transaction_data.copy() + threaddata.transaction_data.pop('ecache', None) return session def add_relation(self, fromeid, rtype, toeid):