4
4
5
5
from collections import OrderedDict
6
6
7
+ import django
7
8
from django .contrib .staticfiles import finders
8
9
from django .contrib .staticfiles .storage import staticfiles_storage
9
10
from django .utils import six
@@ -19,6 +20,11 @@ def __init__(self, storage=None):
19
20
storage = staticfiles_storage
20
21
self .storage = storage
21
22
23
+ def _get_modified_time (self , storage , prefixed_path ):
24
+ if django .VERSION [:2 ] >= (1 , 10 ):
25
+ return storage .get_modified_time (prefixed_path )
26
+ return storage .modified_time (prefixed_path )
27
+
22
28
def clear (self , path = "" ):
23
29
dirs , files = self .storage .listdir (path )
24
30
for f in files :
@@ -65,14 +71,14 @@ def delete_file(self, path, prefixed_path, source_storage):
65
71
if self .storage .exists (prefixed_path ):
66
72
try :
67
73
# When was the target file modified last time?
68
- target_last_modified = self .storage . modified_time ( prefixed_path )
74
+ target_last_modified = self ._get_modified_time ( self . storage , prefixed_path )
69
75
except (OSError , NotImplementedError , AttributeError ):
70
76
# The storage doesn't support ``modified_time`` or failed
71
77
pass
72
78
else :
73
79
try :
74
80
# When was the source file modified last time?
75
- source_last_modified = source_storage . modified_time ( path )
81
+ source_last_modified = self . _get_modified_time ( source_storage , prefixed_path )
76
82
except (OSError , NotImplementedError , AttributeError ):
77
83
pass
78
84
else :
0 commit comments