X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ae60b2a3949e96357477cc04f90fd0873cee8a92..3c0e373447323b5e33b273859e790a2054771afa:/src/catalogue/utils.py diff --git a/src/catalogue/utils.py b/src/catalogue/utils.py index e79b4392c..e94c67d0b 100644 --- a/src/catalogue/utils.py +++ b/src/catalogue/utils.py @@ -4,6 +4,7 @@ # from collections import defaultdict import hashlib +import os.path import random import re import time @@ -345,3 +346,11 @@ class AppSettings(object): def delete_from_cache_by_language(cache, key_template): cache.delete_many([key_template % lc for lc, ln in settings.LANGUAGES]) + + +def gallery_path(slug): + return os.path.join(settings.MEDIA_ROOT, settings.IMAGE_DIR, slug) + + +def gallery_url(slug): + return '%s%s%s/' % (settings.MEDIA_URL, settings.IMAGE_DIR, slug)