Spaces:
Sleeping
Sleeping
wip
Browse files
sabiduria_tool_api/services/service_sabiduria_tool.py
CHANGED
@@ -27,19 +27,15 @@ class FileProcess:
|
|
27 |
}
|
28 |
|
29 |
async def save_files(self) -> None:
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
for file in self.files:
|
38 |
-
|
39 |
-
|
40 |
-
copyfileobj(file.file, destination)
|
41 |
-
except Exception as e:
|
42 |
-
logger.error(f"Error saving file: {e}")
|
43 |
|
44 |
|
45 |
def get_files(self) -> list:
|
|
|
27 |
}
|
28 |
|
29 |
async def save_files(self) -> None:
|
30 |
+
if isdir(self.data_store_path):
|
31 |
+
old_files = self.get_files()
|
32 |
+
for o_file in old_files:
|
33 |
+
remove(f"{self.data_store_path}{o_file}")
|
34 |
+
else:
|
35 |
+
mkdir(self.data_store_path)
|
|
|
36 |
for file in self.files:
|
37 |
+
with open(f"{self.data_store_path}{file.filename}", "wb") as destination:
|
38 |
+
copyfileobj(file.file, destination)
|
|
|
|
|
|
|
39 |
|
40 |
|
41 |
def get_files(self) -> list:
|