Source code for richy.core.storage

import os

from django.conf import settings
from django.core.files.storage import FileSystemStorage


[docs] class OverwriteStorage(FileSystemStorage): """ Storage that removes already existing file when checking if the new filename isavailable. """ def get_available_name(self, name, **kwargs): if self.exists(name): os.remove(os.path.join(settings.MEDIA_ROOT, name)) return name