from django.apps import apps
from django.conf import settings
from django.core.files.storage import DefaultStorage
-from django.core.files.uploadedfile import UploadedFile
from django.http import HttpResponse
from django.utils.encoding import force_str
return result
-class ExistingFile(UploadedFile):
-
- def __init__(self, path, *args, **kwargs):
- self.path = path
- super(ExistingFile, self).__init__(*args, **kwargs)
-
- def temporary_file_path(self):
- return self.path
-
- def close(self):
- pass
-
-
class LockFile(object):
"""
A file lock monitor class; createas an ${objname}.lock
return urljoin(base_url, url)
-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)