fnp
/
audio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add project and funding tags to audiobooks,
[audio.git]
/
apps
/
archive
/
utils.py
diff --git
a/apps/archive/utils.py
b/apps/archive/utils.py
index
6e0a8d1
..
c69fe1c
100755
(executable)
--- a/
apps/archive/utils.py
+++ b/
apps/archive/utils.py
@@
-1,4
+1,5
@@
from hashlib import sha1
from hashlib import sha1
+from django.core.files.storage import FileSystemStorage
from django.core.files.uploadedfile import UploadedFile
from django.core.files.uploadedfile import UploadedFile
@@
-15,6
+16,17
@@
class ExistingFile(UploadedFile):
pass
pass
+class OverwriteStorage(FileSystemStorage):
+
+ def _save(self, name, content):
+ if self.exists(name):
+ self.delete(name)
+ return super(OverwriteStorage, self)._save(name, content)
+
+ def get_available_name(self, name):
+ return name
+
+
def sha1_file(f):
sha = sha1()
for piece in iter(lambda: f.read(1024*1024), ''):
def sha1_file(f):
sha = sha1()
for piece in iter(lambda: f.read(1024*1024), ''):