From b3ea0bf90c381d31936f81c96dffd25ca30a1664 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 18 Nov 2011 13:02:21 +0100 Subject: [PATCH] fix report removal --- apps/reporting/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/reporting/utils.py b/apps/reporting/utils.py index 0f04995be..cc4e97a29 100755 --- a/apps/reporting/utils.py +++ b/apps/reporting/utils.py @@ -2,6 +2,7 @@ # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # +from errno import ENOENT import os import os.path from django.conf import settings @@ -72,7 +73,11 @@ def generated_file_view(file_name, mime_type, send_name=None, signals=None): send_name = os.path.basename(file_name) def signal_handler(*args, **kwargs): - os.unlink(file_path) + try: + os.unlink(file_path) + except OSError as oe: + if oe.errno != ENOENT: + raise oe if signals: for signal in signals: -- 2.20.1