[server] Drop close/open steps in NativeSQLSource.restore()
The only place where this is called is in
ServerMigrationHelper.restore_database() where config.init_cnxset_pool is set
to False. So these steps appear to be useless.
--- a/cubicweb/server/sources/native.py Tue Feb 07 10:37:37 2017 +0100
+++ b/cubicweb/server/sources/native.py Thu Feb 23 17:38:47 2017 +0100
@@ -417,19 +417,13 @@
def restore(self, backupfile, confirm, drop, format='native'):
"""method called to restore a backup of source's data"""
- if self.repo.config.init_cnxset_pool:
- self.close_source_connections()
- try:
- if format == 'portable':
- helper = DatabaseIndependentBackupRestore(self)
- helper.restore(backupfile)
- elif format == 'native':
- self.restore_from_file(backupfile, confirm, drop=drop)
- else:
- raise ValueError('Unknown format %r' % format)
- finally:
- if self.repo.config.init_cnxset_pool:
- self.open_source_connections()
+ if format == 'portable':
+ helper = DatabaseIndependentBackupRestore(self)
+ helper.restore(backupfile)
+ elif format == 'native':
+ self.restore_from_file(backupfile, confirm, drop=drop)
+ else:
+ raise ValueError('Unknown format %r' % format)
def init(self, activated, source_entity):
super(NativeSQLSource, self).init(activated, source_entity)