# HG changeset patch # User Julien Cristau # Date 1396601213 -7200 # Node ID eba0e1b033ab87a89611932f770ea7ee3e6b7917 # Parent 1676d316171d908683d4d4642d6160f3d3a3e4ee [server] move security/integrity hook management away from InternalSession.__init__ and to Repository.internal_{session,cnx} instead. Lets internal_cnx avoid deprecation warnings. diff -r 1676d316171d -r eba0e1b033ab server/repository.py --- a/server/repository.py Thu Apr 03 17:25:53 2014 +0200 +++ b/server/repository.py Fri Apr 04 10:46:53 2014 +0200 @@ -925,7 +925,11 @@ session once the job's done, else you'll leak connections set up to the time where no one is available, causing irremediable freeze... """ - session = InternalSession(self, cnxprops, safe) + session = InternalSession(self, cnxprops) + if not safe: + session.disable_hook_categories('integrity') + session.disable_hook_categories('security') + session._cnx.ctx_count += 1 session.set_cnxset() return session @@ -942,7 +946,8 @@ """ with InternalSession(self) as session: with session.new_cnx() as cnx: - yield cnx + with cnx.allow_all_hooks_but('security'): + yield cnx def _get_session(self, sessionid, setcnxset=False, txid=None, diff -r 1676d316171d -r eba0e1b033ab server/session.py --- a/server/session.py Thu Apr 03 17:25:53 2014 +0200 +++ b/server/session.py Fri Apr 04 10:46:53 2014 +0200 @@ -1748,10 +1748,6 @@ super(InternalSession, self).__init__(InternalManager(), repo, cnxprops, _id='internal') self.user._cw = self # XXX remove when "vreg = user._cw.vreg" hack in entity.py is gone - if not safe: - self.disable_hook_categories('integrity') - self.disable_hook_categories('security') - self._cnx.ctx_count += 1 def __enter__(self): return self