From 5767a4cec1018349191a60406a82b6a4d2ae431a Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Wed, 6 Apr 2016 14:11:54 +0200 Subject: [PATCH] fix in publishing --- src/catalogue/models/book.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index f1501d02c..3811bbac1 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -251,9 +251,10 @@ class Book(models.Model): def download_pictures(self, remote_gallery_url): gallery_path = self.gallery_path() # delete previous files, so we don't include old files in ebooks - for filename in os.listdir(gallery_path): - file_path = os.path.join(gallery_path, filename) - os.unlink(file_path) + if os.path.isdir(gallery_path): + for filename in os.listdir(gallery_path): + file_path = os.path.join(gallery_path, filename) + os.unlink(file_path) ilustr_elements = list(self.wldocument().edoc.findall('//ilustr')) if ilustr_elements: makedirs(gallery_path) -- 2.20.1