compress.filters.FilterBase alllows setting the verbosity while

object creation. Since I specify this in settings, I do not have
a control over setting the verbosity.

This change allow settings the verbosity from settings.
This commit is contained in:
Shabda Raaj
2010-08-04 01:41:08 +10:00
committed by Jannis Leidel
parent 94caf830f6
commit 9c6a371aaa
3 changed files with 13 additions and 1 deletions

View File

@@ -33,3 +33,6 @@ MTIME_DELAY = getattr(settings, 'COMPRESS_MTIME_DELAY', None)
# the backend to use when parsing the JavaScript or Stylesheet files
PARSER = getattr(settings, 'COMPRESS_PARSER', 'compressor.parser.BeautifulSoupParser')
# Allows changing verbosity from the settings.
VERBOSE = getattr(settings, "COMPRESS_VERBOSE", False)

View File

@@ -1,13 +1,15 @@
from compressor.exceptions import FilterError
from compressor.utils import get_class, get_mod_func
from compressor.conf import settings
class FilterBase(object):
def __init__(self, content, filter_type=None, verbose=0):
self.type = filter_type
self.content = content
self.verbose = verbose
self.verbose = verbose or settings.VERBOSE
def input(self, **kwargs):
raise NotImplementedError
def output(self, **kwargs):
raise NotImplementedError

View File

@@ -357,3 +357,10 @@ class StorageTestCase(TestCase):
context = { 'MEDIA_URL': settings.MEDIA_URL }
out = u'<link rel="stylesheet" href="/media/CACHE/css/5b231a62e9a6.css.gz" type="text/css" charset="utf-8" />'
self.assertEqual(out, render(template, context))
class VerboseTestCase(CompressorTestCase):
def setUp(self):
super(VerboseTestCase, self).setUp()
setattr(settings, "COMPRESS_VERBOSE", True)