X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/b2d342589a7889a3b096e7192453d53bd28eed7d..f82fa14e5f5b02994272fc0b588e557d5be6f2a4:/src/catalogue/utils.py?ds=sidebyside 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)