server/repository.py
changeset 9604 eba0e1b033ab
parent 9602 9fb2f15d5e85
child 9607 6942622fd5dc
--- 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,