Skip to content

Commit

Permalink
Replaced the (seemingly) obsolete COMPRESS setting with COMPRESS_ENAB…
Browse files Browse the repository at this point in the history
…LED in the doc and commands help.
  • Loading branch information
jphalip committed Aug 3, 2011
1 parent 8c7961d commit 3b8400d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion compressor/conf.py
Expand Up @@ -61,7 +61,7 @@ class CompressorSettings(AppSettings):
OFFLINE_CONTEXT = {}

def configure_enabled(self, value):
return value or getattr(global_settings, 'COMPRESS', value)
return value or getattr(global_settings, 'COMPRESS_ENABLED', value)

def configure_root(self, value):
if value is None:
Expand Down
8 changes: 4 additions & 4 deletions compressor/management/commands/compress.py
Expand Up @@ -33,8 +33,8 @@ class Command(NoArgsCommand):
'separate multiple extensions with commas, or use -e '
'multiple times)'),
make_option('-f', '--force', default=False, action='store_true',
help="Force generation of compressor content even if "
"COMPRESS setting is not True.", dest='force'),
help="Force the generation of compressed content even if the "
"COMPRESS_ENABLED setting is not True.", dest='force'),
make_option('--follow-links', default=False, action='store_true',
help="Follow symlinks when traversing the COMPRESS_ROOT "
"(which defaults to MEDIA_ROOT). Be aware that using this "
Expand All @@ -58,7 +58,7 @@ def get_loaders(self):
from django.template.loader import template_source_loaders
loaders = []
# If template loader is CachedTemplateLoader, return the loaders
# that it wraps around. So if we have
# that it wraps around. So if we have
# TEMPLATE_LOADERS = (
# ('django.template.loaders.cached.Loader', (
# 'django.template.loaders.filesystem.Loader',
Expand Down Expand Up @@ -211,7 +211,7 @@ 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 "
"Compressor is disabled. Set the COMPRESS_ENABLED "
"settting or use --force to override.")
if not settings.COMPRESS_OFFLINE:
if not options.get("force"):
Expand Down
9 changes: 5 additions & 4 deletions docs/settings.txt
Expand Up @@ -6,15 +6,16 @@ Settings
Django Compressor has a number of settings that control its behavior.
They've been given sensible defaults.

.. _compress:
.. _compress_enabled:

COMPRESS
^^^^^^^^
COMPRESS_ENABLED
^^^^^^^^^^^^^^^^

:Default: the opposite of ``DEBUG``

Boolean that decides if compression will happen. In order to test compression
when ``DEBUG`` is enabled COMPRESS needs to explicitly be set to ``True``.
when ``DEBUG`` is enabled COMPRESS_ENABLED needs to explicitly be set to
``True``.

.. _compress_url:

Expand Down
12 changes: 6 additions & 6 deletions docs/usage.txt
Expand Up @@ -48,13 +48,13 @@ Which would be rendered something like:

Linked files **must** be accessible via :ref:`COMPRESS_URL <compress_url>`.

If the :ref:`COMPRESS <compress>` setting is ``False`` (defaults to the
opposite of DEBUG) the ``compress`` template tag does nothing and simply returns
exactly what it was given.
If the :ref:`COMPRESS_ENABLED <compress_enabled>` setting is ``False``
(defaults to the opposite of DEBUG) the ``compress`` template tag does nothing
and simply returns exactly what it was given.

If both DEBUG and :ref:`COMPRESS <compress>` are set to ``True``, incompressible
files (off-site or non existent) will throw an exception. If DEBUG is ``False``
these files will be silently stripped.
If both DEBUG and :ref:`COMPRESS_ENABLED <compress_enabled>` are set to
``True``, incompressible files (off-site or non existent) will throw an
exception. If DEBUG is ``False`` these files will be silently stripped.

.. warning::

Expand Down

0 comments on commit 3b8400d

Please sign in to comment.