Created
January 6, 2013 17:19
-
-
Save anonymous/4468776 to your computer and use it in GitHub Desktop.
Custom storage for Django Pipeline with cached-files + S3 storage via boto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from boto.utils import parse_ts | |
from django.contrib.staticfiles.storage import CachedFilesMixin | |
from pipeline.storage import PipelineMixin | |
from storages.backends.s3boto import S3BotoStorage | |
class S3PipelineStorage(PipelineMixin, CachedFilesMixin, S3BotoStorage): | |
# Fix for django-storages can't parse datetime error | |
# https://github.com/ulyssesv/django-cached-s3-storage/blob/master/cached_s3_storage.py | |
def modified_time(self, name): | |
name = self._normalize_name(self._clean_name(name)) | |
entry = self.entries.get(name) | |
if entry is None: | |
entry = self.bucket.get_key(self._encode_name(name)) | |
# Parse the last_modified string to a local datetime object. | |
return parse_ts(entry.last_modified) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment