# HG changeset patch # User Pierre-Yves David # Date 1372777744 -7200 # Node ID aff75b69db92f7321723df08e84884124edaa426 # Parent e0b63ea2c65bd10f82c536d1147899c73e5fb89c [repository] drop safe attribute on ``internal_cnx`` People that need to disable hook can do it explicitly anyway. diff -r e0b63ea2c65b -r aff75b69db92 doc/4.0.rst --- a/doc/4.0.rst Thu Jun 27 19:18:54 2013 +0200 +++ b/doc/4.0.rst Tue Jul 02 17:09:04 2013 +0200 @@ -33,8 +33,8 @@ same Transaction. However, Connection object are not thread safe. ``repository.internal_session`` is deprecated in favor of -``repository.internal_cnx``. Note that internal connection are now safe by -default. Integrity hooks are enabled except stated otherwise. +``repository.internal_cnx``. Note that internal connection are now safe. +Integrity hooks are enabled. Backward compact is preserved on Session. They can still be used to access the database for the next few version. diff -r e0b63ea2c65b -r aff75b69db92 server/repository.py --- a/server/repository.py Thu Jun 27 19:18:54 2013 +0200 +++ b/server/repository.py Tue Jul 02 17:09:04 2013 +0200 @@ -953,6 +953,8 @@ every rights on the repository. The `safe` argument is a boolean flag telling if integrity hooks should be activated or not. + /!\ the safe argument is False by default. + *YOU HAVE TO* commit/rollback or close (rollback implicitly) the session once the job's done, else you'll leak connections set up to the time where no one is available, causing irremediable freeze... @@ -962,17 +964,17 @@ return session @contextmanager - def internal_cnx(self, safe=True): + def internal_cnx(self): """return a Connection using internal user which have - every rights on the repository. The `safe` argument is a boolean flag - telling if integrity hooks should be activated or not. + every rights on the repository. The `safe` argument is dropped. all + hook are enabled by default. - /!\ IN OPPOSITE OF THE OLDER INTERNAL_SESSION, INTERNAL CONNECTION ARE SAFE - /!\ BY DEFAULT. + /!\ IN OPPOSITE OF THE OLDER INTERNAL_SESSION, + /!\ INTERNAL CONNECTION HAVE ALL HOOKS ENABLED. This is to be used a context manager. """ - with InternalSession(self, safe) as session: + with InternalSession(self) as session: with session.new_cnx() as cnx: yield cnx