X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ec4c9d6d4e2ce8c31123c48fb140b1d75e762155..8505074633ff2e2194b7f845fc84f2040686e570:/src/catalogue/utils.py diff --git a/src/catalogue/utils.py b/src/catalogue/utils.py index d17ead0e6..ca8ec0dc2 100644 --- a/src/catalogue/utils.py +++ b/src/catalogue/utils.py @@ -303,7 +303,7 @@ def delete_from_cache_by_language(cache, key_template): def gallery_path(slug): - return os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, slug) + return os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, slug) + '/' def gallery_url(slug): @@ -313,3 +313,9 @@ def gallery_url(slug): def get_mp3_length(path): from mutagen.mp3 import MP3 return int(MP3(path).info.length) + + +def set_file_permissions(self, fieldfile): + if fieldfile.instance.preview: + fieldfile.set_readable(False) +