X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/dbb1ae2cf25105f7a3831961b08386a1326baef8..a6145bb10676f304d4a3de6789c383f1f9326055:/apps/catalogue/utils.py diff --git a/apps/catalogue/utils.py b/apps/catalogue/utils.py index 98ee36c04..a0e834c60 100644 --- a/apps/catalogue/utils.py +++ b/apps/catalogue/utils.py @@ -49,25 +49,6 @@ def split_tags(tags, initial=None): return result -def get_dynamic_path(media, filename, ext=None, maxlen=100): - from fnpdjango.utils.text.slughifi import slughifi - - # how to put related book's slug here? - if not ext: - # BookMedia case - ext = media.formats[media.type].ext - if media is None or not media.name: - name = slughifi(filename.split(".")[0]) - else: - name = slughifi(media.name) - return 'book/%s/%s.%s' % (ext, name[:maxlen-len('book/%s/.%s' % (ext, ext))-4], ext) - - -# TODO: why is this hard-coded ? -def book_upload_path(ext=None, maxlen=100): - return lambda *args: get_dynamic_path(*args, ext=ext, maxlen=maxlen) - - class ExistingFile(UploadedFile): def __init__(self, path, *args, **kwargs):