+++ /dev/null
- - Fix makecontribmessages command.
-
-v0.1.6 2013-03-20
- - Update to Django 1.5
-
-v0.1.5 2013-02-22
- - Make prevnext respect current GET parameters.
- - Add a management command for localizing contrib apps.
- - Fix deployment sudo problem.
-
-v0.1.4 2013-01-10
- - Add tQ function for filtering translated fields.
-
-v0.1.3 2013-01-09
- - Fix get_here_url.
- - Nicer project starter.
- - Fix deployment scripts.
-
-v0.1.2 2012-11-30
- - Added app settings.
- - Fix deployment scripts.
- - Minor fixes.
-
-v0.1.1 2012-11-22
- - Deployment scripts.
- - Minor fixes.
-
-v0.1 2012-11-05
- - Initial release.
-
--- /dev/null
+# -*- coding: utf-8 -*-
+# This file is part of FNPDjango, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from django.core.files.storage import FileSystemStorage
+
+class BofhStorageMixin(FileSystemStorage):
+ """Bastard Operator From Hell file storage for Django.
+
+ When a user asks for a place available for saving a file and
+ the proposed filename is occupied, default Django file storage
+ looks for a free spot by appending a suffix.
+
+ This storage just deletes the previous content and replies:
+ sure, just save it right where you want it.
+
+ The user is now responsible for making sure they don't
+ accidentally overwrite anything they weren't supposed to,
+ and for sane caching settings.
+
+ """
+ def get_available_name(self, name):
+ if self.exists(name):
+ self.delete(name)
+ return name
+
+class BofhFileSystemStorage(BofhStorageMixin, FileSystemStorage):
+ """Bastard Operator From Hell storage for standard filesystem."""
+ pass