summaryrefslogtreecommitdiff
path: root/ishtar_common/tasks.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-08-20 15:42:38 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-10-15 19:32:59 +0200
commit7efe436fd9b794ed585a675bf0cbaf9ff4c8464d (patch)
tree7ead31f9d396e4202593e43c56e197ff2e84cfdd /ishtar_common/tasks.py
parent22089564f871cb265646e878291fecd423edf188 (diff)
downloadIshtar-7efe436fd9b794ed585a675bf0cbaf9ff4c8464d.tar.bz2
Ishtar-7efe436fd9b794ed585a675bf0cbaf9ff4c8464d.zip
🐛 fix unclosed file
Diffstat (limited to 'ishtar_common/tasks.py')
-rw-r--r--ishtar_common/tasks.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ishtar_common/tasks.py b/ishtar_common/tasks.py
index 55c704ab1..24ae02dcc 100644
--- a/ishtar_common/tasks.py
+++ b/ishtar_common/tasks.py
@@ -173,13 +173,13 @@ def launch_export(export_task_id):
if not export_task.geo:
kwargs["no_geo"] = True
archive_name = full_serialization(**kwargs)
- result = open(archive_name, "rb")
- export_task.result.save(archive_name.split(os.sep)[-1], File(result))
- os.remove(archive_name)
- export_task.finished_date = datetime.datetime.now()
- export_task.state = "F"
- export_task.result_info = str(_("Export finished"))
- export_task.save()
+ with open(archive_name, "rb") as result:
+ export_task.result.save(archive_name.split(os.sep)[-1], File(result))
+ os.remove(archive_name)
+ export_task.finished_date = datetime.datetime.now()
+ export_task.state = "F"
+ export_task.result_info = str(_("Export finished"))
+ export_task.save()
def update_towns():