Skip to content

Commit

Permalink
Implemented a few storage methods introduced in Django 1.3 but missin…
Browse files Browse the repository at this point in the history
…g in older versions of Django. Closes disqusGH-11.
  • Loading branch information
jezdez committed Mar 22, 2011
1 parent 2404f16 commit c5b91aa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions compressor/storage.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down

0 comments on commit c5b91aa

Please sign in to comment.