diff --git a/compressor/storage.py b/compressor/storage.py index 93334bcc..8f0adea5 100644 --- a/compressor/storage.py +++ b/compressor/storage.py @@ -1,4 +1,6 @@ import gzip +from os import path +from datetime import datetime from django.core.files.storage import FileSystemStorage, get_storage_class from django.utils.functional import LazyObject @@ -21,6 +23,15 @@ def __init__(self, location=None, base_url=None, *args, **kwargs): super(CompressorFileStorage, self).__init__(location, base_url, *args, **kwargs) + def accessed_time(self, name): + return datetime.fromtimestamp(path.getatime(self.path(name))) + + def created_time(self, name): + return datetime.fromtimestamp(path.getctime(self.path(name))) + + def modified_time(self, name): + return datetime.fromtimestamp(path.getmtime(self.path(name))) + def get_available_name(self, name): """ Deletes the given file if it exists.