def end(self): if 'backup_dir' not in self.config: backup_dir = str_input('specify backup directory') self.config['backup_dir'] = backup_dir write_backup(self.db, self.config['backup_dir']) remove_old_backups(self.config['backup_dir']) db_disconnect(self.db)
def select_backup(self): filename = list_choice(listdir(self.config['backup_dir'])) if bool_question('are you sure you want to overwrite all data?', default=False): # first of all, backup existing data write_backup(self.db, self.config['backup_dir']) # now load new data load_backup(self.db, filename, self.config['backup_dir'])