Fixed #27658 -- Prevented collectstatic from overwriting newer files in remote storages.

Thanks revimi for the initial patch.
This commit is contained in:
Tim Graham 2017-01-03 19:03:08 -05:00
parent f60d4e704d
commit c85831e4b7
5 changed files with 46 additions and 5 deletions

View file

@ -1,6 +1,6 @@
import errno
import os
from datetime import datetime
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
@ -59,6 +59,14 @@ class PathNotImplementedStorage(storage.Storage):
raise NotImplementedError
class NeverCopyRemoteStorage(PathNotImplementedStorage):
"""
Return a future modified time for all files so that nothing is collected.
"""
def get_modified_time(self, name):
return datetime.now() + timedelta(days=30)
class QueryStringStorage(storage.Storage):
def url(self, path):
return path + '?a=b&c=d'