X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/4dad587dac33c6c04d9a1a594fbbd1c58dbf2bda..0c502550a4f04aa016df8729af2ae2f85c0b495a:/src/catalogue/models/book.py?ds=sidebyside diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index ea4debde9..b624abcad 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -139,6 +139,8 @@ class Book(models.Model): SORT_KEY_SEP = '$' + is_book = True + class AlreadyExists(Exception): pass @@ -561,6 +563,7 @@ class Book(models.Model): # will make problems in conjunction with paid previews def download_pictures(self, remote_gallery_url): + # This is only needed for legacy relative image paths. gallery_path = self.gallery_path() # delete previous files, so we don't include old files in ebooks if os.path.isdir(gallery_path): @@ -572,6 +575,8 @@ class Book(models.Model): makedirs(gallery_path) for ilustr in ilustr_elements: ilustr_src = ilustr.get('src') + if '/' in ilustr_src: + continue ilustr_path = os.path.join(gallery_path, ilustr_src) urlretrieve('%s/%s' % (remote_gallery_url, ilustr_src), ilustr_path)