1 # -*- coding: utf-8 -*-
2 # This file is part of FNPDjango, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.core.files.storage import FileSystemStorage
7 class BofhStorageMixin(FileSystemStorage):
8 """Bastard Operator From Hell file storage for Django.
10 When a user asks for a place available for saving a file and
11 the proposed filename is occupied, default Django file storage
12 looks for a free spot by appending a suffix.
14 This storage just deletes the previous content and replies:
15 sure, just save it right where you want it.
17 The user is now responsible for making sure they don't
18 accidentally overwrite anything they weren't supposed to,
19 and for sane caching settings.
22 def get_available_name(self, name):
27 class BofhFileSystemStorage(BofhStorageMixin, FileSystemStorage):
28 """Bastard Operator From Hell storage for standard filesystem."""