From: Jan Szejko Date: Wed, 6 Apr 2016 12:11:54 +0000 (+0200) Subject: fix in publishing X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/5767a4cec1018349191a60406a82b6a4d2ae431a?ds=inline fix in publishing --- 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)