Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/0.6b1'

  • Loading branch information...
commit 55a02cfb7ce1d5fd1e2405df87b84b931ad022ee 2 parents 4996394 + 6364670
@jezdez jezdez authored
View
2  compressor/__init__.py
@@ -1,4 +1,4 @@
-VERSION = (0, 6, 0, "a", 11) # following PEP 386
+VERSION = (0, 6, 0, "b", 1) # following PEP 386
DEV_N = None
View
11 compressor/management/commands/compress.py
@@ -143,8 +143,8 @@ def compress(self, log=None, **options):
cache.set(key, result, settings.COMPRESS_OFFLINE_TIMEOUT)
results.append(result)
count += 1
- log.write("done\nCompressed %d block(s) from %d template(s).\n"
- % (count, len(compressor_nodes)))
+ log.write("done\nCompressed %d block(s) from %d template(s).\n" %
+ (count, len(compressor_nodes)))
return count, results
def walk_nodes(self, node):
@@ -183,13 +183,10 @@ def handle_extensions(self, extensions=('html',)):
def handle_noargs(self, **options):
if not settings.COMPRESS_ENABLED and not options.get("force"):
- raise CommandError("Compressor is disabled. Set COMPRESS "
- "settting to True to enable it "
- "(Use -f/--force to override).")
+ raise CommandError("Compressor is disabled. Set COMPRESS settting or use --force to override.")
if not settings.COMPRESS_OFFLINE:
if not options.get("force"):
- raise CommandError("Aborting; COMPRESS_OFFLINE is not set. "
- "(Use -f/--force to override)")
+ raise CommandError("Offline compressiong is disabled. Set COMPRESS_OFFLINE or use the --force to override.")
warnings.warn("COMPRESS_OFFLINE is not set. Offline generated "
"cache will not be used.")
self.compress(sys.stdout, **options)
View
5 compressor/settings.py
@@ -1,5 +1,6 @@
import os
+from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
@@ -105,14 +106,14 @@ def configure_url(self, value):
def configure_cache_backend(self, value):
if value is None:
# If we are on Django 1.3 AND using the new CACHES setting...
- if getattr(settings, "CACHES", None):
+ if getattr(settings, "CACHES", None) and DJANGO_VERSION[:2] >= (1, 3):
return "default"
# fallback for people still using the old CACHE_BACKEND setting
return settings.CACHE_BACKEND
return value
def configure_offline_context(self, value):
- if value:
+ if not value:
value = {
'MEDIA_URL': settings.MEDIA_URL,
}
View
4 compressor/templatetags/compress.py
@@ -50,9 +50,9 @@ def render(self, context, compress=settings.COMPRESS_ENABLED, offline=settings.C
compressor = CssCompressor(content)
if self.kind == 'js':
compressor = JsCompressor(content)
- cachekey = "%s-%s" % (compressor.cachekey, self.mode)
+ cachekey = "%s.%s" % (compressor.cachekey, self.mode)
output = self.cache_get(cachekey)
- if output is None:
+ if output is None or not offline:
try:
if self.mode == OUTPUT_FILE:
output = compressor.output()
View
13 compressor/tests/tests.py
@@ -2,6 +2,11 @@
import re
from BeautifulSoup import BeautifulSoup
+try:
+ import lxml
+except ImportError:
+ lxml = None
+
from django.core.cache.backends import dummy
from django.core.files.storage import get_storage_class
from django.template import Template, Context, TemplateSyntaxError
@@ -111,13 +116,7 @@ def test_custom_output_dir(self):
self.assertEqual(output, JsCompressor(self.js).output())
settings.COMPRESS_OUTPUT_DIR = old_output_dir
-
-try:
- import lxml
-except ImportError:
- import warnings
- warnings.warn("lxml library couldn't be found, skipping tests.")
-else:
+if lxml:
class LxmlCompressorTestCase(CompressorTestCase):
def test_css_split(self):
View
2  docs/conf.py
@@ -50,7 +50,7 @@
# The short X.Y version.
version = '0.6'
# The full version, including alpha/beta/rc tags.
-release = '0.6a11'
+release = '0.6b1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Please sign in to comment.
Something went wrong with that request. Please try again.