[testlib, realdb] we should close connections prior to create a new db using current db as template stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 14 Jun 2011 22:54:20 +0200
branchstable
changeset 7506 c8cda2aca92e
parent 7505 e04790a6eea8
child 7507 4c043afb104a
[testlib, realdb] we should close connections prior to create a new db using current db as template
devtools/__init__.py
--- a/devtools/__init__.py	Tue Jun 14 17:15:40 2011 +0200
+++ b/devtools/__init__.py	Tue Jun 14 22:54:20 2011 +0200
@@ -600,15 +600,18 @@
     def _backup_database(self, db_id):
         """Actual backup the current database.
 
-        return a value to be stored in db_cache to allow restoration"""
+        return a value to be stored in db_cache to allow restoration
+        """
         from cubicweb.server.serverctl import createdb
         orig_name = self.system_source['db-name']
         try:
             backup_name = self._backup_name(db_id)
             self._drop(backup_name)
             self.system_source['db-name'] = backup_name
+            self._repo.turn_repo_off()
             createdb(self.helper, self.system_source, self.dbcnx, self.cursor, template=orig_name)
             self.dbcnx.commit()
+            self._repo.turn_repo_on()
             return backup_name
         finally:
             self.system_source['db-name'] = orig_name