mirror of https://github.com/gmbrax/Pilgrim.git
				
				
				
			Compare commits
	
		
			8 Commits
		
	
	
		
			9bbccdc676
			...
			3c71b0abe6
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 3c71b0abe6 | |
|  | c3397ab982 | |
|  | bb9457978c | |
|  | c09425cd48 | |
|  | 7c950b93ab | |
|  | 17371088da | |
|  | 209099cc5e | |
|  | 890fc470bb | 
|  | @ -14,9 +14,12 @@ class BackupService: | |||
|         db_path = DirectoryManager.get_database_path() | ||||
|         if not db_path.exists(): | ||||
|             raise FileNotFoundError("No Database Found") | ||||
|         conn = self.session.connection().connection | ||||
|         dump = "\n".join(line for line in conn.iterdump()) | ||||
|         filename = str(DirectoryManager.get_config_directory()) + "/backup.zip" | ||||
| 
 | ||||
|         with self.session.connection() as conn: | ||||
|             raw_conn = conn.connection | ||||
|             dump = "\n".join(line for line in raw_conn.iterdump()) | ||||
| 
 | ||||
|         filename = DirectoryManager.get_config_directory() / "backup.zip" | ||||
|         diaries_root_path = DirectoryManager.get_diaries_root() | ||||
| 
 | ||||
|         try: | ||||
|  | @ -27,7 +30,7 @@ class BackupService: | |||
|                         if file_path.is_file(): | ||||
|                             arcname = file_path.relative_to(diaries_root_path.parent) | ||||
|                             zipf.write(file_path, arcname=arcname) | ||||
|                 return True, None | ||||
|                 return True, filename | ||||
|         except Exception as e: | ||||
|             return False, str(e) | ||||
| 
 | ||||
|  |  | |||
|  | @ -306,7 +306,12 @@ class DiaryListScreen(Screen): | |||
|         session = self.app.service_manager.get_session() | ||||
|         if session: | ||||
|             backup_service = BackupService(session) | ||||
|             result = backup_service.create_backup() | ||||
|             result_operation, result_data = backup_service.create_backup() | ||||
|             if result_operation: | ||||
|                 self.notify(f"Backup result: {result_data}") | ||||
|             else: | ||||
|             self.notify("You must be logged in to perform this action") | ||||
|         self.notify(f"Backup result: {result}") | ||||
|                 self.notify(f"Error performing backup: {result_data}") | ||||
|         else: | ||||
|             self.notify("Error: Session not found",severity="error") | ||||
|             self.app.exit() | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue