X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3204e4303148302d278036eebcfc8cb105cc97d7..f9c19bbcbc514aebcff44b37ca5b92b4a0e181cf:/src/dvcs/storage.py?ds=inline diff --git a/src/dvcs/storage.py b/src/dvcs/storage.py deleted file mode 100755 index a57d759f..00000000 --- a/src/dvcs/storage.py +++ /dev/null @@ -1,22 +0,0 @@ -from zlib import compress, decompress - -from django.core.files.base import ContentFile, File -from django.core.files.storage import FileSystemStorage -from django.utils.deconstruct import deconstructible -from django.utils.encoding import force_bytes - - -@deconstructible -class GzipFileSystemStorage(FileSystemStorage): - def _open(self, name, mode='rb'): - """TODO: This is good for reading; what about writing?""" - f = open(self.path(name), 'rb') - text = f.read() - f.close() - return ContentFile(decompress(text)) - - def _save(self, name, content): - data = force_bytes(content.read()) - content = ContentFile(compress(data)) - - return super(GzipFileSystemStorage, self)._save(name, content)