# HG changeset patch # User Aurelien Campeas # Date 1401463531 -7200 # Node ID 47d356ee14d236265f9fef840eca6e9cedec5b3f # Parent ae624d86c652cc74405a7f201cdb62da8925f748 [devtools] pre_setup_database should take a connection object diff -r ae624d86c652 -r 47d356ee14d2 devtools/__init__.py --- a/devtools/__init__.py Fri May 30 11:10:54 2014 +0200 +++ b/devtools/__init__.py Fri May 30 17:25:31 2014 +0200 @@ -490,15 +490,9 @@ self.restore_database(DEFAULT_EMPTY_DB_ID) repo = self.get_repo(startup=True) cnx = self.get_cnx() - session = repo._sessions[cnx.sessionid] - session.set_cnxset() - _commit = session.commit - def keep_cnxset_commit(free_cnxset=False): - _commit(free_cnxset=free_cnxset) - session.commit = keep_cnxset_commit - pre_setup_func(session, self.config) - session.commit() - cnx.close() + with cnx: + pre_setup_func(cnx, self.config) + cnx.commit() self.backup_database(test_db_id)