X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b2d342589a7889a3b096e7192453d53bd28eed7d..b9dc6590aa12ae1b04e11dbb57684c5630c1e3bd:/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)