Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support cloud completely #954

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions compressor/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import with_statement, unicode_literals
import os
import codecs
from importlib import import_module

import six
Expand All @@ -15,7 +14,7 @@
from compressor.exceptions import (CompressorError, UncompressableFileError,
FilterDoesNotExist)
from compressor.filters import CachedCompilerFilter
from compressor.storage import compressor_file_storage
from compressor.storage import compressor_file_storage, default_storage
from compressor.signals import post_compress
from compressor.utils import get_class, get_mod_func, staticfiles

Expand Down Expand Up @@ -168,9 +167,9 @@ def get_filecontent(self, filename, charset):
if charset == 'utf-8':
# Removes BOM
charset = 'utf-8-sig'
with codecs.open(filename, 'r', charset) as fd:
with default_storage.open(filename) as fd:
try:
return fd.read()
return fd.read().decode(charset)
except IOError as e:
raise UncompressableFileError("IOError while processing "
"'%s': %s" % (filename, e))
Expand Down
4 changes: 2 additions & 2 deletions compressor/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def get_mtime(filename):
key = get_mtime_cachekey(filename)
mtime = cache.get(key)
if mtime is None:
mtime = os.path.getmtime(filename)
mtime = default_storage.get_modified_time(filename).timestamp()
cache.set(key, mtime, settings.COMPRESS_MTIME_DELAY)
return mtime
return os.path.getmtime(filename)
return default_storage.get_modified_time(filename).timestamp()


def get_hashed_mtime(filename, length=12):
Expand Down