equal
deleted
inserted
replaced
923 |
923 |
924 *YOU HAVE TO* commit/rollback or close (rollback implicitly) the |
924 *YOU HAVE TO* commit/rollback or close (rollback implicitly) the |
925 session once the job's done, else you'll leak connections set up to the |
925 session once the job's done, else you'll leak connections set up to the |
926 time where no one is available, causing irremediable freeze... |
926 time where no one is available, causing irremediable freeze... |
927 """ |
927 """ |
928 session = InternalSession(self, cnxprops, safe) |
928 session = InternalSession(self, cnxprops) |
|
929 if not safe: |
|
930 session.disable_hook_categories('integrity') |
|
931 session.disable_hook_categories('security') |
|
932 session._cnx.ctx_count += 1 |
929 session.set_cnxset() |
933 session.set_cnxset() |
930 return session |
934 return session |
931 |
935 |
932 @contextmanager |
936 @contextmanager |
933 def internal_cnx(self): |
937 def internal_cnx(self): |
940 |
944 |
941 This is to be used a context manager. |
945 This is to be used a context manager. |
942 """ |
946 """ |
943 with InternalSession(self) as session: |
947 with InternalSession(self) as session: |
944 with session.new_cnx() as cnx: |
948 with session.new_cnx() as cnx: |
945 yield cnx |
949 with cnx.allow_all_hooks_but('security'): |
|
950 yield cnx |
946 |
951 |
947 |
952 |
948 def _get_session(self, sessionid, setcnxset=False, txid=None, |
953 def _get_session(self, sessionid, setcnxset=False, txid=None, |
949 checkshuttingdown=True): |
954 checkshuttingdown=True): |
950 """return the session associated with the given session identifier""" |
955 """return the session associated with the given session identifier""" |